su切换至root
cd /usr/local/
yum install zlib-devel bzip2-devel libffi-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
选择python版本
wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz
解压
tar -zxvf Python-3.9.6.tgz
进入文件夹
cd Python-3.9.6
./configure prefix=/usr/local/python3
make && make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python