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 ...
随机推荐
- JDK 8 - java.util.HashSet 实现机制分析
JDK 8 Class HashSet<E> Doc: public class HashSet<E> extends AbstractSet<E> impleme ...
- java流类、、、理解不够,流太多不知怎么用好?
总结:输入流.输出流..子类多.需要加强: package com.da; import java.io.*; public class rtr { public static void main(S ...
- POJ 3624 Charm Bracelet(01背包模板)
Charm Bracelet Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 45191 Accepted: 19318 ...
- 2015.3.12Arinc424 Tools中SiniArincCls.csParserFile(string sFile)函数正则表达式理解
原文: string RegEx1 = @"(\[ITEM\]\s*=[\S\s]*?(?=\[ITEM\])|\[ITEM\]\s*=[\S\s]*)";//用来识别主记录和后续 ...
- python中引号中有双引号
#/usr/bin/python import os name = "ABC" #ABC是具体的模块名,产品经理每一次给的模块名字都不一样 os.environ['name'] = ...
- python中匹配中文,解决不匹配,乱码等问题
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 0: ordinal 字符串前加 ur‘str’即可;
- PROCEDURE存储过程传入表参数
) ,itemNum ) ,itemQty )) ---2.创建一个存储过程以表值参数作为输入 alter proc usp_TestProcWithTable @tb LocationTa ...
- cocos2d-x坐标系详解
cocos2d-x官方文档 笛卡尔坐标系 不同坐标系简介 笛卡尔坐标系 你可能上学的时候就已经知道“笛卡尔坐标系”了,它在几何课本里经常用到.如果你已经忘得差不多了,下面这些图片可以很快唤起你的记忆: ...
- SQL获取时间戳流水号
流水号生成规则: 1:流水号总长度为22位数 2:流水号总共分三部分:标头(2位)+ 时间戳(YYYYMMDDHHmmSSsss共17位)+ 随机码(3位) 举例流水号:SN2015081210240 ...
- Java Learning 002 Eclipse软件 打开一个工程 和 运行这个工程
Java Eclipse软件 打开一个工程 和 运行这个工程 我在网上下载了一个 Java 工程源代码.使用Eclipse软件打开这个工程,打开方式有些特别: Step 1 . 点击: File -& ...