How to upgrade python to python 2.7 Under centos 5.x, centos 5.xpython2.7

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.