1.准备安装工具

yum groupinstall "Development tools"

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-develtk-devel gdbm-devel db4-devel libpcap-devel xz-devel

2.下载python3源码

wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz

3.解压

tar  xf Python-3.7.5.tgz ./

4.进入下载目录

cd Python-3.7.5

5.编译

./configure --prefix=/usr/local/python3
make&& make install

6.创建软链接

ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3