What if CentOS 6.4 upgrades Python and yum is not available?

  

In the operation of CentOS system, yum is not available when upgrading Python, and yum is a more important software. How to deal with this problem? The following small series will introduce you to the solution that CentOS 6.4 upgrade Python causes yum to be unavailable.

1, check the current python version

1python -V

2, download the 2.7.3 version of Python

1wget http: //python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2

3. Unpack and install

tar -jxvf Python-2.7.3.tar .bz2

#Enter the unzipped directory

cd Python-2.7.3

#compile and install

. /configure

make

make install

4. Check if the installation is successful

/usr/local/bin/python2.7 -V

#If the following message appears, the installation is successful

Python 2.7.3

5, create a soft link

#Normally, even if python2.7 is successfully installed, The default python pointed to by the system is still version 2.6.6. Considering that yum is based on python 2.6.6, it works fine, so it is not recommended to uninstall.

#Use the following method to change the default python of the system to version 2.7.3

mv /usr/bin/python /usr/bin/python2.6.6

ln -s /usr/local/bin/python2.7 /usr/bin/python

#detecting success

python -V

#2.7.3 version information Representative success

Python 2.7.3

6. Solve the problem that yum is not available after modifying the default python version of the system

#Modify yum file

vi /usr/bin/yum


#! /usr/bin/python

Change to the following content

#! /usr/bin/python2.6.6

The entire upgrade process is complete.

7, other problems

After the above 6 steps of the operation yum is available, but I do not know which cow has modified the system's files, resulting in the use of yum or prompt no Named yum error message. After reviewing the information, it is known to make the version of yum's head python.

But I have already modified it (step 6), I don't know how to solve it. Finally, I gave up the "Da Niang", using Google, which is often harmonized, to find a document on the Centos official website, as follows.

First find the CD or ISO file where you installed Centos, as long as the system version is the same. Copy the following files to the system:

python-2.6.6-36.el6.x86_64.rpm

python-urlgrabber-3.9.1-8.el6.noarch.rpm

python-devel-2.6.6-36.el6.x86_64.rpm

python-libs-2.6.6-36.el6.x86_64.rpm

yum-3.2.29 -40.el6.centos.noarch.rpm

The specific version number is subject to your system disk or ISO. I copied it to the following directory

/usr/local/src/Python-2.6.6

Execute the installation

cd /usr/local/src/Python-2.6. 6/

rpm -Uvh --replacepkgs *.rpm

#The following prompt appears

Preparing. . ###############################################################################

1: python-libs ###################################################################### # [ 20%]

2:python ################################################# ####### [ 40%]

3: python-urlgrabber ########################################## ############### [ 60%]

4:yum ##################################### ####################[80%]

5:python-devel ############## ############################################ [100%]

Execute the yum command, the interface you are familiar with appears.

The above is a description of the solution that CentOS 6.4 upgrades Python to make yum unusable. After all, reloading yum is cumbersome and not necessarily feasible. You can use the method described in this article to fix it.

Copyright © Windows knowledge All Rights Reserved