yum remove python-3* 先卸载所有之前装的python-3。
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
yum -y install epel-release
yum -y install python-pip
wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz
tar -xvf Python-3.9.0.tar.xz
cd Python-3.9.0
./configure --prefix=/usr/local/python3
make && make install
最后验证:
[root@localhost src]# python3 --version
Python 3.9.0 (即成功)