the ssl module in Python is not available错误解决
在使用pip安装pymongo的过程中报错,提示如下:
$ pip3 install pymongo
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting pymongo
Could not fetch URL https://pypi.python.org/simple/pymongo/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement pymongo (from versions: )
No matching distribution found for pymongo
这是由于缺少ssl模块,进入python中验证。
$ python
Python 3.7.0a3 (default, Jan 10 2018, 14:36:35)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/ssl.py", line 100, in <module>
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
>>>
原因找到:缺少openssl-devel包
$ rpm -qa | grep openssl
openssl-1.0.2k-8.el7.x86_64
xmlsec1-openssl-1.2.20-7.el7_4.x86_64
openssl-libs-1.0.2k-8.el7.x86_64
解决方法:
1、安装openssl-devel包
$ sudo yum install -y openssl-devel
2、重新编译安装pyhton
修改Setup配置
$ vi Modules/Setup
找到
# Socket module helper for socket(2)
#_socket socketmodule.c # Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
#SSL=/usr/local/ssl
#_ssl _ssl.c \
# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
# -L$(SSL)/lib -lssl -lcrypto
改为
# Socket module helper for socket(2)
_socket socketmodule.c # Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
#SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
编译安装
./configure && sudo make && sudo make install
验证:
$ python
Python 3.7.0a3 (default, Jan 10 2018, 15:13:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>>
安装pymongo
$ sudo /usr/local/bin/pip3 install pymongo
Collecting pymongo
Downloading pymongo-3.6..tar.gz (581kB)
% |████████████████████████████████| 583kB 28kB/s
Installing collected packages: pymongo
Running setup.py install for pymongo ... done
Successfully installed pymongo-3.6.
安装完成
the ssl module in Python is not available错误解决的更多相关文章
- 【Linux】CentOS6上安装Python3.7(config、make、make install)及“No module named '_ctypes'”/pip install时“ssl module in Python is not available.”的解决
1.下载安装包 https://www.python.org/ftp/python/ 该目录下选择所需要的版本进行下载.解压. wget https://www.python.org/ftp/pyth ...
- pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
# 背景 安装pip后发现执行pip install pytest,提示下面错误 pip is configured with locations that require TLS/SSL, howe ...
- pip install 时报错 pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
pip install 时报错: pip is configured with locations that require TLS/SSL, however the ssl module in Py ...
- Python更新pip出现错误解决方法
Python更新pip出现错误解决方法 更新pip python -m pip install --upgrade pip 查看时报错 解决方法 在命令栏(即win+r)输入:easy_install ...
- python中的TypeError错误解决办法
新手在学习python时候,会遇到很多的坑,下面来具体说说其中一个. 在使用python编写面向对象的程序时,新手可能遇到TypeError: this constructor takes no ar ...
- Python Flask UnicodeDecodeError 编码错误解决
折腾Python做快速Web开发.最后定下来用Flask,相对教程全面. utf8编码上遇到问题,所有文件已经是utf8编码保存,加载css.js等静态文件,如果用GBK编码就正常:用utf8就报Un ...
- python 安装中的错误解决
最近使用python3.5,其中遇到安装中的错误,现在记录下来,提个醒 1 安装setuptools 出现缺少 zlib模块 解决: 1 yum install zlib 2 yum install ...
- python读文件出现错误解决方法
python读文件经常会出现 UnicodeDecodeError: 'gbk' codec can't decode byte 0xbd in position 764: illegal multi ...
- python3.6 SSL module is not available
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not avail ...
随机推荐
- 蓝桥杯 算法训练 ALGO-125 王、后传说
算法训练 王.后传说 时间限制:1.0s 内存限制:256.0MB 问题描述 地球人都知道,在国际象棋中,后如同太阳,光芒四射,威风八面,它能控制横.坚.斜线位置. 看过清宫戏的中国人都知道, ...
- Oracle 11g R2(11.2.0.4) RAC 数据文件路径错误解决--ORA-01157 ORA-01110: 数据文件
Oracle 11g R2(11.2.0.1) RAC 数据文件路径错误解决--ORA-01157 ORA-01110: 数据文件 oracle 11g R2(11.2.0.4) rac--scan ...
- JCTF 2014(Misc)
小试身手: 点击下载附件 res/raw/hehe,打开 得到flag
- [MySQL]修改mysql数据库的root密码的方法
方法1: 用SET PASSWORD命令 mysql -u root mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass ...
- 有关Backgroundworker
(一)Backgroundworker取消时应该用的有关代码: CancelAsync方法是在前台主线程用的,CancellationPending属性是在后台子线程用的.实际的使用方式应该是这样的: ...
- 2016.8.17服务器端数据库用户导入导出方法 expdp和impdp
EXP和IMP是客户端工具程序,它们既可以在客户端使用,也可以在服务端使用. EXPDP和IMPDP是服务端的工具程序,他们只能在ORACLE服务端使用,不能在客户端使用. IMP只适用于EXP导出的 ...
- 2015.3.20 Oracle使用正则表达式
.Oracle正则表达式使用介绍 正则表达式具有强大.便捷.高效的文本处理功能.能够添加.删除.分析.叠加.插入和修整各种类型的文本和数据.Oracle从10g开始支持正则表达式 ..下面通过一些例子 ...
- 1107SQLserver基础--语句、存储过程
[随堂练习]--查询‘李数’老师教的数学成绩大于80分的学生的信息, 并且人数大于3的话,输出达标:否则输出不达标. 存储过程 --带参数的程序代码块---代表执行命令存储在数据库中,存储代码,没有调 ...
- oracle时间段查询-从00:00:00开始
之所以记录一下这篇博文,是因为前段时间搞的一个查询发现要从00:00:00这个时间段开始,必须要通过拼接字符串. <select id="queryApplyProgressList& ...
- ssh框架搭建实例代码教程步骤
http://blog.csdn.net/u010539352/article/details/49255729