Detailed steps for upgrading Python2.7 version in CentOS

Source: Internet
Author: User
Tags bz2 centos
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.

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.