1、python下载
mkdir /usr/local/python3 wget http://cdn.npm.taobao.org/dist/python/3.6.5/Python-3.6.5.tgz tar -zxvf Python-3.6.5.tgz
2、安装编译Python3源文件所需的编译环境
yum install -y gcc yum install -y zlib*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
3.进入Python3 源文件文件夹
cd Python-3.6.5/
4.指定安装目录
./configure --prefix=/usr/local/python3 --with-ssl
5.编译源文件
make
6.正式安装
make install
7.建立软连接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
8.添加环境变量
vi ~/.bash_profile
直接在path后面添加/usr/local/python3/bin 然后source ~/.bash_profile使变量生效