#升级版本 1
2
3
4
5
6
7
8
9
10
| yum -y install gcc
cd /opt
wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar xf Python-2.7.6.tgz
./configure --prefix=/usr/local/python2.7
cd Python-2.7.6
./configure --prefix=/usr/local/python2.7
make && make install
mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python
|
#解决Python升级yum无法使用的办法 1
2
3
4
5
6
7
8
9
10
11
12
13
| [iyunv@localhost yum.repos.d]# yum repolist
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.7.6 (default, Jul 7 2016, 15:02:52)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
|
#查看Python版本 1
2
| [iyunv@localhost init.d]# whereis python
python: /usr/bin/python2.6-config /usr/bin/python.bak /usr/bin/python /usr/bin/python2.6 /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /usr/local/python2.7 /usr/share/man/man1/python.1.gz
|
#配置yum使用回低版本的python 1
2
| [iyunv@localhost init.d]# head -1 /usr/bin/yum
#!/usr/bin/python2.6
|
#yum正常了 1
2
3
4
5
6
7
8
| [iyunv@localhost init.d]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id repo name status
base CentOS-6 - Base - 163.com 6,696
extras CentOS-6 - Extras - 163.com 62
updates CentOS-6 - Updates - 163.com 139
repolist: 6,897
|
因为Yum是基于Python写的,升级了Python版本,Yum就调用了高版本的Python,所以报错
|