把CentOS6.5默认的python2.6升级到了python2.7,然后运行yum命令的时候就出现了错误:
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.13 (default, Aug 18 2017, 21:52:09)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
原因是因为yum是用python写的,并不兼容2.7,所以运行会报错。解决办法是修改yum源文件,指定python版本为老版本。
前提是升级的时候按照要求备份了老版本的软链接。
vi /usr/bin/yum
修改第一行
#!/usr/bin/python
#!/usr/bin/python26
此处评论已关闭