参考 https://www.cnblogs.com/pyyu/p/7402145.html?tdsourcetag=s_pcqq_aiomsg
1 下载
网址:https://www.python.org/downloads/release/python-362/
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz
2 前期环境
yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y
3 解压安装
tar -xf Python-3.4.7.tar
2.进入python3源码包路径,开始编译安装
./configure --prefix=/opt/python3/ #生成一个makefile文件
make
make install
4 添加环境变量
export PATH=/opt/python3/bin/:$PATH
source /etc/profile 使得配置文件生效
4.测试直接输入 python3,能否进入python