python3导入ssl报错_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的

于是我进入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,发现正常,问题解决!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值