Install related packages for subsequent compilation and installation of python3
$ yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make -y
Download the python3 source package
$ cd /usr/local
$ wget https://www.python.org/ftp/python/3.7.15/Python-3.7.15.tgz
unzip and install
$ tar -zxvf Python-3.7.15.tgz
$ cd Python-3.7.15
$ ./configure prefix=/usr/local/python3
$ make && make install
Configure python environment variables
vi /etc/profile
# 在profile文件追加下面两行
export PYTHON_HOME=/usr/local/python3/
export PATH=$PYTHON_HOME/bin:$PATH
# 保存并推出,使配置生效
source /etc/profile
verify python