python 安装: WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in

550次阅读
没有评论
python

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

系统CENTOS6.10,安装Python3时遇到了如下问题,在CENTOS7系统上安装时未遇到上述问题。

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

感谢狐狸已妖化提供的解决方案
##解决方案如下

1、原因

系统版本centos6.10,其中openssl的版本为OpenSSL 1.0.1e-fips 11 Feb 2013,而python3.7需要的openssl的版本为1.0.2或者1.1.x,需要对openssl进行升级,并重新编译python3.7.0。yum 安装的openssl 版本都比较低。

2、升级openssl

2.1下载openssl

wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz tar -zxvf openssl-1.1.1a.tar.gz cd openssl-1.1.1a

2.2 编译安装

./config –prefix=/usr/local/openssl no-zlib #不需要zlib make make install

2.3 备份原配置

mv /usr/bin/openssl /usr/bin/openssl.bak mv /usr/include/openssl/ /usr/include/openssl.bak

2.4 新版配置

ln -s /usr/local/openssl/include/openssl /usr/include/openssl ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/local/lib64/libssl.so ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl

2.5 修改系统配置

## 写入openssl库文件的搜索路径 echo "/usr/local/openssl/lib" >> /etc/ld.so.conf ## 使修改后的/etc/ld.so.conf生效 ldconfig -v

6.查看openssl版本

openssl version

openssl version 提示:

/usr/local/openssl/bin/openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

假如你的libssl.so.1.1 文件在/usr/local/openssl/lib/下面,可以这样做

ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1

ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

然后重新安装Python3

./configure –prefix=/usr/local/python3 –with-openssl=/usr/local/openssl make make install

神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:Python基础教程2022-11-22发表,共计1455字。
新手QQ群:570568346,欢迎进群讨论 Python51学习