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

Ubuntu安装python3.10.4后使用pip,出现以下错误:
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
解决办法:

#下载
wget https://www.openssl.org/source/openssl-1.1.1n.tar.gz
#解压
tar -xzvf openssl-1.1.1n.tar.gz 
#进入
cd openssl-1.1.1n/
#配置
./config
#make
sudo make
#make install
sudo make install
#检查安装是否成功
openssl version

安装完成后可能会出现的错误:
error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

解决办法:

sudo ln -s /usr/local/lib/libssl.so.1.1 /usr/lib/libssl.so.1.1
sudo ln -s /usr/local/lib/libcrypto.so.1.1 /usr/lib/libcrypto.so.1.1

你可能感兴趣的:(python,ssl)