刚装上Python3.11,使用pip过程中出现 TLS/SSL 报错
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
解决方案:
下载并安装 openssl-1.1.1s 版本,编译参考该链接
wget --no-check-certificate https://www.openssl.org/source/openssl-1.1.1s.tar.gz
tar zxf openssl-1.1.1s.tar.gz
cd openssl-1.1.1s
./config -fPIC -shared --prefix=/path/to/openssl-1.1.1s_build
make && make install
安装好openssl之后,重新安装python3.11
cd Python-3.11.1
./configure -enable-optimizations --enable-shared --enable-loadable-sqlite-extensions --with-openssl-rpath=auto --prefix=/path/to/Python-3.11.1_build --with-openssl=/path/to/openssl-1.1.1s_build
make && make install
export LD_LIBRARY_PATH=/path/to/Python-3.11.1_build/lib:$LD_LIBRARY_PATH
下载pandas测试python3是否可用
./Python-3.11.1_build/bin/python3 -m pip install pandas
发现太慢了,参考CSDN博客将国内镜像直接添加到配置中
mkdir -p ~/.pip
vi ~/.pip/pip.conf
将下面内容添加到 ~/.pip/pip.conf文件中,保存退出
[global]
timeout = 8
index-url = http://mirrors.aliyun.com/pypi/simple/
extra-index-url = http://pypi.douban.com/simple/
[install]
trusted-host=
mirrors.aliyun.com
pypi.douban.com