## 1. 下载安装包
wget https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz
## 2. 安装依赖
yum install -y gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
## 3. 编译安装 python3
tar -zxf Python-3.10.6.tgz
cd Python-3.10.6
./configure --prefix=/usr/local/python3/
make -j 10 && make install
## 4. 将python3添加到环境变量
vim /etc/profile
PATH=/usr/local/python3/bin:$PATH
source /etc/profile
##5. 创建符号链接指向python3
mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/local/python3/bin/python3 /usr/bin/python
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
The End.