跳到主要内容

Centos 7 Pip 不能使用tls错误的解决办法

· 阅读需 1 分钟
forkp

前言

使用 pip install redis的时候提示错误

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

由于centos7的套件比较老旧,所以得升级openssl库

执行命令安装

sudo yum install openssl11 openssl11-devel
mkdir /usr/local/openssl11
cd /usr/local/openssl11
ln -s /usr/lib64/openssl11 lib
ln -s /usr/include/openssl11 include

编译 Python3.12

./configure --prefix=/usr/local/python3.12 --with-ssl=/usr/local/openssl11
make && make install

搞定收工