1 安装依赖
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
2 下载
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
3 安装
tar -xzvf Python-3.6.0.tgz -C
cd /Python-3.6.0
./configure --prefix=/usr/local
如果遇到:configure: error: no acceptable C compiler found in $PATH
解决方法:# yum install gcc
make
make altinstall
4 修改配置
mv /usr/bin/python /user/bin/python.backup
ln -s /usr/local/bin/python3.6 /usr/bin/python
ln -s /usr/local/bin/python3.6 /usr/bin/python3
vi /usr/bin/yum
vi /usr/libexec/urlgrabber-ext-dow
更改以上文件头为
#!/usr/bin/python 改为 #!/usr/bin/python2