升级前安装依赖
yum groupinstall "Development tools"
Python 2.7.9 下载>解压>编译>安装
1 | wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz |
- 关于altinstall
1
2Warning
make install can overwrite or masquerade the python binary. make altinstall is therefore recommended instead of make install since it only installs exec_prefix/bin/pythonversion.
修改系统默认Python
- 查看已有python版本
python -V
- 查看Python版本
/usr/local/python/bin/python2.7 -V
- 将系统默认Python改为新安装的Python
ln -fs /usr/local/python/bin/python2.7 /usr/bin/python
yum无法运行问题
进行更改后,yum会无法运行了。修改/usr/bin/yum文件,将第一行的#!/usr/bin/python
中的python改为系统原有的python版本,如下:#!/usr/bin/python2.6