python3 安装

引子

下载Python3 源码

1
[root@user ~]# curl -o Python-3.6.3.tgz https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz

解压

1
tar -xvf Python-3.6.3.tgz

编译可能需要库

1
2
yum -y groupinstall development
yum -y install zlib-devel

编译 安装

1
2
3
4
5
mkdir /usr/local/python3
cd Python-3.6.3
./configure --prefix=/usr/local/python3
make
make install

设置Python3环境变量

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