CentOS 5 Upgrade Python version (2.4>2.7)

Source: Internet
Author: User

When installing salt, you need to do this, the company has a group of REDHAT5, get up ...

And then it was:

Missing Dependency:python (ABI) = 2.6 is needed by package

Rpm-q--provides Python | grep Abi

Python (ABI) = 2.4

The process is smooth, refer to the URL:

Http://www.linuxidc.com/Linux/2012-02/55194.htm

A few days ago, when setting up a test environment on CentOS, we encountered the need to upgrade the Python version and recorded the entire upgrade process:

The Python version that comes with CentOS5 is 2.4, but many Python-based applications now require a Python version higher than 2.4. When upgrading the Python version, you must not uninstall Python 2.4, and then install python2.7, there will be endless trouble, the conservative way is to install the python2.7 source package directly, that is, Python two version coexistence. (because there are many programs in CentOS that rely on Python, it's best not to try to uninstall python2.4).

(1) Download/install Python

Download python2.7.2.tgz (# wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz)

    1. $tar JXVF python2.7.2.tgz
    2. $CD Python2.7.2
    3. $./configure
    4. $make && make Install

Since then, the python2.7 installation path defaults to the/usr/local/lib/python2.7
To view the Python version:
$/usr/local/bin/python2.7-v

(2) Establish a soft connection so that the system default Python points to python2.7
Under normal circumstances, even though the python2.7 installation succeeds, the system is pointing to a python that is still version 2.4, considering that Yum is based on the
python2.4 to work properly, not easy to uninstall. How do you point to the system default Python to version 2.7?
Mv/usr/bin/python/usr/bin/python.bak (or Rm-rf/usr/bin/python)
Ln-s/usr/local/bin/python2.7/usr/bin/python
Verify that the Python point is successful
Python-v

(3) Fix system python soft link to python2.7 version, Yum does not work properly
Method:
$vi/usr/bin/yum

The first line of text editing is displayed
#!/usr/bin/python modified to #!/usr/bin/python2.4, save the changes can be

CentOS 5 Upgrade Python version (2.4>2.7)

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.