#更新yum
#yum update
安装依赖包
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel gcc make
下载安装包并将安装包放到虚拟机中
https://www.python.org/ftp/3.7.5/Python-3.7.5.tgz
解压缩
tar xf Python-3.7.5.tgz
安装
./configure --prefix=/usr/local/python3 # 配置编译路径
make && make install
添加软连接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
加入到PATH环境变量
vim /etc/profile
export PATH=$PATH:/usr/local/python3/bin
退出并保存
source /etc/profile