1. Download the source code
wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
2. Decompression
Tar zxvf python-2.7.11.tgz
3. Installation
CD Python-2.7.11
./configure--prefix=/usr/local/python27
Make && make install
4, modify the system default Python, and update
Mv/usr/bin/python/usr/bin/python2.6.old
Ln-s/usr/local/python27/bin/python2.7/usr/bin/python
5. Testing
Python-v, showing 2.7.11
6. Change the Yum Interpreter
Since Yum uses the Python interpreter, enter the command Yum list, which displays
There was a problem importing one of the Python modules
Required to run Yum. The error leading to this problem was:
No module named Yum
Install a package which provides this module, or
Verify the module is installed correctly.
It ' s possible that the above module doesn ' t match the
Current version of Python
Vi/usr/bin/yum
Change the #!/usr/bin/python of the file header to #!/usr/bin/python2.6
This article is from the Linux Essentials blog, so be sure to keep this source http://chaoyuezhangsan.blog.51cto.com/7176886/1768998
CentOS compiled installation python