Centos 上python3 pip3安装报错:WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

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

在网上查一下原因是openssl版本不兼容导致,centos默认带的openssl版本太低,要升级openssl版本。

openssl  下载地址:https://www.openssl.org/source/old/

下载:wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz

解压缩包:

tar zxvf openssl-1.1.1w.tar.gz

编译安装:

进入 openssl-1.1.1w 文件夹
cd openssl-1.1.1w
./config --prefix=/usr/local/openssl
make && make install

安装完成:

 备份旧的openssl:

mv /usr/bin/openssl /usr/bin/openssl.back 
mv /usr/include/openssl/ /usr/include/openssl.back

配置新的openssl:

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

修改系统配置:

echo "/usr/local/openssl/lib" >> /etc/ld.so.conf

使用新配置立即生效:

ldconfig -v

查看openssl 版本

openssl version

重新编辑安装python3

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

安装完成,使用pip3进行安装插件

 

 

问题1:openssl config编译失败:

Operating system: x86_64-whatever-linux2

You need Perl 5.

 解决方式:安装Perl 5

Perl 下载地址:https://www.cpan.org/src/

wget https://www.cpan.org/src/5.0/perl-5.30.1.tar.gz
tar -xzf perl-5.30.1.tar.gz
cd perl-5.30.1
./Configure -des -Dprefix=$HOME/localperl
make
make install

 

posted @ 2024-03-02 11:25  西夏一品唐  阅读(604)  评论(0编辑  收藏  举报