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

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

例如这样:
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 xxxmarkdown

网上查说是缺乏OpenSSL-dev,可是我本机是已经安装了OpenSSL的fetch

因而我进入Python2,导入ssl模块没有问题,可是进入Python3,导入ssl模块报错了ui

本人查阅资料发现,在./configure过程当中,若是没有加上–with-ssl参数时,默认安装的软件涉及到ssl的功能不可用,恰好pip3过程须要ssl模块,而因为没有指定,因此该功能不可用。code

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

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

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

相关文章
相关标签/搜索