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 ...
随机推荐
- Azure CLI的版本问题
Azure支持多种管理方法.命令行方法有: PowerShell,PowerShell只能运行在Windows上 Azure CLI,而Azure CLI可以运行在Windows.MAC以及Linux ...
- 安装CenOS7.4 LNMP环境
从头开始安装环境 1.在vmware中安装最新的CentOS7.4 linux版本下载地址:http://man.linuxde.net/download/ 下载好的东东为:iso后缀的文件 安装教程 ...
- nginx提示Error: Too many open files的解决办法
nginx提示:Too many open files这种错误问题的原因是因为linux文件系统最大可打开文件数为1024,而你的nginx中的error.log出现大量的Too many open ...
- SQL 从身份证号得到出生日期、年龄、男女
), CONVERT(smalldatetime, SUBSTRING(b.IDCard, , )), ) AS BrithDate_Name, DATEDIFF(year, CONVERT(smal ...
- Nor Flash的CFI与JEDEC接口
Flash 存储器接口还有两个标准:CFI和JEDEC.CFI为公共Flash接口[Common Flash Interface],用来帮助程序从Flash芯片中获取操作方式信息(发送命令,从nor ...
- 生产者与消费者--demo1---bai
import java.util.ArrayList; import java.util.List; import java.util.Random; //自定义类,描述仓库 public class ...
- 开发环境入门 linux基础(部分)虚拟内存,rpm和yum安装
虚拟内存,rpm和yum安装 文本中查找 /内容 替换:扩展模式下(:)%s /替换目标/要替换的文件/ (只替换第一个)(后边加g全部替换) :set u添加行号 raid lvm逻辑卷 df - ...
- 基于windows平台的命令行软件安装工具Chocolatey的安装
本文介绍Chocolatey的安装和使用 Chocolatey 这是基于.NET Framework 4以上的windows安装软件的命令行工具 安装 第一步,打开你的powershell.exe,使 ...
- TypeError: 'append' called on an object that does not implement interface FormData 解决方法
使用ajax提交form表单时,$("formId").serialize()不能提交type="file"类型的input,这个时候可以选择使用FormDat ...
- latex bib format
LaTeX 的对参考文献的处理实在是非常的方便,我用过几次,有些体会,写出来供大家参考.当然,自己的功力还不够深,有些地方问题一解决就罢手了,没有细究. LaTeX 对参考文献的处理有这么一些优点: ...