背景
尝试在centos7上自己编译安装 Python3.10
yum update -y yum groupinstall "Development Tools" -y yum install openssl-devel libffi-devel libffi-devel bzip2-devel -y gcc --version yum install wget -y wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz tar xvf Python-3.10.0.tgz cd Python-3.10.0 ./configure --enable-optimizations make altinstall python3.10 --version
在尝试安装pip包的时候提示我:“Can’t connect to HTTPS URL because the SSL module is not available.”
好像是编译安装的Python没有ssl模块
解决问题
单独编译安装openssl
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz tar zxvf openssl-1.1.1g.tar.gz cd openssl-1.1.1g ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl no-ssl2 make make install
重新编译安装Python
cd Python-3.10.0 ./configure --enable-optimizations --with-openssl=/usr/local/openssl make altinstall python3 -m ssl
参考资料:
https://zomro.com/blog/faq/294-kak-ustanovit-python-310-na-centos-7