CentOS 7 安装 Python3 环境
检查 Python 版本
shell
python
安装依赖包
shell
yum -y groupinstall "Development tools"
shell
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
下载 Python3
shell
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
安装 Python3
shell
mkdir /usr/local/python3
tar -xvJf Python-3.7.2.tar.xz
cd Python-3.7.2
./configure --prefix=/usr/local/python3
make && make install
创建软链接
shell
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
检查 Python3 版本
shell
python3