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.