How to upgrade python to python 2.7 Under centos 5.x, centos 5.xpython2.7
First download python2.7.3 from the official website, compile and install it
Copy codeThe Code is as follows:
$ Wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
$ Tar zxvf Python-2.7.3.tgz
$ Cd Python-2.7.3
$./Configure
$ Make & make install
Back up the original python and connect python2.7 to the new location.
Copy codeThe Code is as follows:
$ Mv/usr/bin/python. bak
$ Ln-s/usr/local/bin/python2.7/usr/bin/python
$ Python-V
Version 2.7.3
Change yum to make it run normally
Copy codeThe Code is as follows:
$ Vim/usr/bin/yum
Change #/usr/bin/python to #/usr/bin/python2.4 so that yum can run normally.
Install easy_install
Copy codeThe Code is as follows:
$ Yum install python-setuptools
Install python-setuptools and download python-setuptools from the pypi website. The version must be the same as that of yum. Otherwise, the following error occurs during running:
Copy codeThe Code is as follows:
$ Easy_install rsa
Traceback (most recent call last ):
File "/usr/bin/easy_install", line 5, in <module>
From pkg_resources import load_entry_point
ImportError: No module named pkg_resources
Then:
Copy codeThe Code is as follows:
$ Wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c5.tar.gz
$ Tar zxvf setuptools-0.6c5.tar.gz
$ Setuptools-0.6c5 cd
$ Python setup. py install
After the installation is successful, you can easily use easy_install to install the python library.