源码包地址:
https://www.python.org/ftp/python/3.9.15/Python-3.9.15.tgz
环境准备:
yum -y install gcc bzip2-devel sqlite-devel openssl-devel readline-devel xz-devel xz-devel tk-devel gdbm-devel libffi-devel wget
下载源码包:
wget https://www.python.org/ftp/python/3.9.15/Python-3.9.15.tgz
解压源码包
tar -zxvf Python-3.9.15.tgz
进入已解压的源码包
cd Python-3.9.15.tgz
编译:
./configure --prefix=/usr/local/python3 --with-ssl
安装:
make && make install
修改软连接
ln -s /usr/local/python3/bin/python3.9 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.9 /usr/bin/pip3
升级pip
pip install --upgrade pip