View the version of Python
[root@localhost ~] Python- v
Python 2.4.3
1. Install GCC First
Yum- y install gcc If there is an error installing GCC,Yum Distro-syncYum Clean All
2. Download Python-2.7.2
[root@localhost ~] wget http://python.org/ftp/python/2.7.2/ python-2.7.2.tar.bz2
3. Unzip the Python-2.7.2
[root@localhost ~] tar -jxvf python-2.7.2.tar.bz2
4. Go to the folder you just unzipped (you can use the command):
[root@localhost ~] cd Python-2.7.2
5. Installation
[Root@localhost Python-2.7.2]. /configure
[Root@localhost Python-2.7.2] make all
[Root@localhost Python-2.7.2] make Install
[Root@localhost Python-2.7.2] make clean
[Root@localhost Python-2.7.2] make distclean
6. View version Information
/ usr/local/bin/python2.7- v
7. Establish a soft connection so that the system default Python points to python2.7
Under normal circumstances, even if the python2.7 installation succeeds, the system pointing to Python is still the 2.4.3 version, considering that Yum is based on python2.4.3 to work properly and does not dare to uninstall easily.
How do you point to the system default Python to version 2.7?
mv/ usr/bin/python/ usr/bin/python2.4
LN- S/ usr/local/bin/python2.7/ usr/bin/python
Verify that the Python point is successful
Python- v
8. Fix system Python soft links to python2.7 version, Yum does not work properly
vi /usr/bin/yum
The file header is
#!/usr/bin/python
Change into
#!/usr/bin/python2.4
Python upgrade to python2.7