Python3中pip3安装模块出错,找不到SSL

CentOS6上安裝完Python3,用pip3之后一直报错,提示没有ssl模块

例如这样:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting xxx
Could not fetch URL https://pypi.python.org/simple/xxxx/: 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 xxx (from versions: )
No matching distribution found for xxx

网上查说是缺少OpenSSL-dev,但是我本机是已经安装了OpenSSL的

《Python3中pip3安装模块出错,找不到SSL》

于是我进入Python2,导入ssl模块没有问题,但是进入Python3,导入ssl模块报错了

本人查阅资料发现,在./configure过程中,如果没有加上–with-ssl参数时,默认安装的软件涉及到ssl的功能不可用,刚好pip3过程需要ssl模块,而由于没有指定,所以该功能不可用。

解决办法是重新对python3.6进行编译安装,用一下过程来实现编译安装:

cd Python-3.6.2
./configure --with-ssl
make
sudo make install

这样就允许安装的python3使用ssl功能模块,进入python3中,执行import ssl发现未出错,正常再次调用pip3指令来安装paramiko,发现正常,问题解决!

    原文作者:python入门
    原文地址: https://my.oschina.net/u/3183099/blog/1608286
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞