CentOS installation of python2.7.1 and Yum can not be used after loading __python

Source: Internet
Author: User

Recently their Redhat python upgraded Python to 2.7, but found that Yum can not use, found a workable solution, we can refer to, reprinted a Netizen's article, the pro-test effective.

Reproduced from: http://www.cnblogs.com/theitnotes/p/4162882.html

Because CentOS's Yum is developed using python2.4.x, a later version of the Python installation is not supported, so manual installation is required.

First install the dependency pack and run the following command

Yum install-y gcc make

Yum install-y libxml2

Yum Install-y libxslt

Yum install-y pkgconfig Zlib-devel

Yum Install-y libgcrypt-devel

#备份文件/usr/bin/python (be sure to back up or Yum will not run after Setup is complete)
mkdir ~/tmp
Cp/usr/bin/python ~/tmp
Execute the following command to download and install the python:
wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz

Tar zxvf python-2.7.1.tgz

CD Python-2.7.1

./configure--prefix=/usr/lib/python2.7--with-threads--enable-shared
Make;make Install

Cp/usr/lib/python2.7/bin/python/usr/bin/python
cp/usr/lib/python2.7/bin/python2.7/usr/bin/
cp/usr/lib/python2.7/lib/libpython2.7.so.1.0/usr/lib/

This python2.7.1 installation is complete.

However, if you run Yum,yum now, there will be a run-time error because Yum only supports the python2.4.x version

You need to overwrite the previously backed up Python file to/usr/bin/python2.4 (when I installed python2.4 also became a python2.7 version) so to do the following, just in case the backup of Python copy to/usr/bin/ python2.4

CP ~/tmp/python/usr/bin/python2.4

Modify/usr/bin/yum

Vi/usr/bin/yum

The first line of

#!/usr/bin/python

Amended to

#!/usr/bin/python2.4

Then save, yum to fix.


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.