Installation of python2.7.1 under CentOS and the problem of Yum not available after loading

Source: Internet
Author: User

Reprinted from Http://blog.163.com/[email protected]/blog/static/164767406201221614650717/

Since the CentOS Yum is developed using the python2.4.x, it does not support a later version of Python installation, so a manual installation is required.

Install the dependency package first, 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 the installation is complete)
mkdir ~/tmp
Cp/usr/bin/python ~/tmp
Execute the following command to download and install 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

The previously backed up Python file needs to be overwritten to/usr/bin/python2.4 (python2.4 also becomes the python2.7 version when I install it) so just in case the following command is executed, copy the backup Python to the/usr/bin/ python2.4

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

Modify/usr/bin/yum

Vi/usr/bin/yum

The first line of the

#!/usr/bin/python

Revision changed to

#!/usr/bin/python2.4

Then save, yum fix.

Installation of python2.7.1 under CentOS and the problem of Yum not available after loading

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.