python3.7.2 ssl版本过低导致pip无法使用的问题

环境:系统是centos6.6,python:python3.7.2

问题:安装好python3、pip后,在通过pip install xx 安装模块时,发现无法安装的问题,提示版本太低,系统默认的是openssl1.0.1,需要1.0.2或者libressl。在网上也搜了各种资料,试了各种方式,终于给试出来了,现总结如下,希望帮到遇到此问题的同学。

错误提示:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Could not fetch URL https:*******: There was a problem confirming the ssl certificate: 
Can't connect to HTTPS URL because the SSL module is not available. - skipping

 

解决:

  安装libressl代替openssl-devel 

   下载libress-2.8.3,wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.8.3.tar.gz

   解压,安装:

tar -zxvf libressl-2.8.3.tar.gz
cd libressl-2.8.3
./config –prefix=/usr/local/ssl 
make 
make intall

#原来的备份
mv /usr/bin/openssl /usr/bin/openssl.bak 
mv /usr/include/openssl /usr/include/openssl.bak 
#建立软链
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl 
ln -s /usr/local/ssl/include/openssl /usr/include/openssl

cd /etc/ld.so.conf.d 
#新建文件 libressl-2.8.3.conf,增加以下内容
/usr/local/ssl/lib
ldconfig -v #重新加载库文件

#验证,如果出来LibreSSL 2.8.3,说明成功
openssl version 

 

然后再进行python3的安装,这样基本上就不会出现上面的问题了

注意:在编译python的环境前,需要做以下环境变量配置:

  export LDFLAGS="-L/usr/local/ssl/lib" 
  export CPPFLAGS="-I/usr/local/ssl/include"
  export PKG_CONFIG_PATH="/usr/local/ssl/lib/pkgconfig"

接下来就可以好好地安装python了。。。

    

转载于:https://www.cnblogs.com/bookwed/p/10251236.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值