The code is as follows |
Copy Code |
./configure Make all Make install Make clean Make Distclean |
No accident, you should be able to see the python2.7 file in/usr/local/bin/, also explained 2.7 installation success. The next thing to do is to use the soft link to the system by default 2.7, the operation is as follows:
The code is as follows |
Copy Code |
Mv/usr/bin/python/usr/bin/bak_python Ln-s/usr/local/bin/python2.7/usr/bin/python |
Now that the upgrade is complete, but because Yum uses Python is 2.4 This version, all Yum can not use, solve this problem is very simple, only need to modify the/usr/bin/yum file, the first line of #!/usr/bin/python replaced by #!/usr/bin /python2.4 can
specific methods of operation
Steps:
First, download the source code package, and decompression
wget http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2
Tar jxvf python-2.7.tar.bz2
CD Python-2.7
Second, start installation
/configure--prefix=/usr/local ### Note: This is installed in the new directory to prevent overwriting the system by default installed Python
Make
Make install
Third, the configuration
Ln-s/usr/local/bin/python/usr/bin/python2.7
Four, test
Python
Enter the CentOS system default installed Python
python2.7
Enter the Python2.7 version of our own installation
In this way, we can keep two different versions of Python in the system at the same time.