1.安装依赖
sudo yum -y groupinstall "Development tools"
sudo 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.安装
下载
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0a1.tar.xz
解压
tar -xvJf Python-3.7.0a1.tar.xz
切换到解压目录
cd Python-3.7.0a1
配置 编译 安装
./configure preix=/usr/local/python3
sudo make
sudo make install
3.设置软链
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
注: 如何删除软链,用rm命令即可,例如
rm /usr/bin/pip3