1、安装依赖包

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel

2、下载Python最新版本

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz

3、 解压tar.xz

tar -xvf Python-3.7.0.tar.xz

4、编译安装

./configure --prefix=/data1/python3

make && make install

5、设置环境

ln -s /data1/python3/bin/python3.7 /usr/bin/python3
ln -s /data1/python3/bin/pip3.7 /usr/bin/pip3
ln -s /data1/python3/bin/ipython3 /usr/bin/ipython3