1. 安装依赖
yum groupinstall "Development Tools"
yum install gcc gcc-c++ openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel
2. 安装OpenSSL1.1.1
wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz --no-check-certificate
tar zxf openssl-1.1.1q.tar.gz
cd openssl-1.1.1q
./config --prefix=/usr/local/openssl-1.1.1
make && make install
3. 安装Python3.10
wget https://www.python.org/ftp/python/3.10.7/Python-3.10.7.tgz
tar xzf Python-3.10.7.tgz
cd Python-3.10.7
./configure --enable-optimizations --with-openssl=/usr/local/openssl-1.1.1
(如果开优化编译失败,就取消优化, 去掉上面的 --enable-optimizations)
make altinstall
4. 检查 Python 版本
python3.10 --version
5. 安装setuptools
如果在安装其他包时遇到没有setuptools的错误提示,需要手工更新setuptools
pip3 install --upgrade setuptools
如果在安装其他包时遇到ModuleNotFoundError: No module named ‘_ctypes’的错误,需要在命令行执行
yum install libffi-devel
然后重新执行
make altinstall
网友评论