- 安装依赖包和编译工具
>yum -y install xz tar gcc make tk-devel wget sqlite-devel zlib-devel readline-devel openssl-devel curl-devel tk-devel gdbm-devel xz-devel bzip2-devel
- 下载python源码包
>wget -c https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz
- xz转tar
- xz -d Python-3.6.3.tar.xz
- 解压/编译
```
tar xvf Python-3.6.3.tar
cd Python-3.6.3/
./configure --prefix=/usr/local/python3
make
make install
```
- 修改环境变量
>echo 'export PATH=/usr/local/python3/bin:$PATH' >> /etc/profile
>source /etc/profile
- 查看版本
>python3 --version
>pip3 --version