python升级引起的版本不兼容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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.12 (default, Aug 17 2016, 09:41:51)
[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

修改执行yum的python至系统默认版本

1
2
3
4
5
6
7
whereis yum
yum: /usr/bin/yum /etc/yum.conf /etc/yum /usr/share/man/man8/yum.8.gz

whereis python
python: /usr/bin/python2.6 /usr/bin/python /usr/bin/python2.7

vim /usr/bin/yum
1
2
3
4
5
6
#!/usr/bin/python 	// 修改为原系统自带的python: #!/usr/bin/python2.6
import sys
try:
import yum
except ImportError:
print >> sys.stderr, ""\"