升级python之后,执行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.3 (default, Jan 18 2015, 10:32:12)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

一般可以通过修改/usr/bin/yum脚本中对python的引用解决。步骤如下:

1、查看当前python版本:

No module named yum

2、查看系统中已安装的python:

No module named yum

3、修改yum脚本

从以上两步骤中得出,之前的python版本应该是2.6,

vi /usr/bin/yum

将#!/usr/bin/python修改为#!/usr/bin/python2.6。再执行yum,恢复正常了。

相关文章:

  • 2021-08-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
  • 2021-03-30
  • 2021-12-07
  • 2021-12-20
  • 2021-04-10
猜你喜欢
  • 2022-02-12
  • 2021-11-26
  • 2022-12-23
  • 2021-04-10
  • 2022-01-04
  • 2021-11-21
  • 2021-06-02
相关资源
相似解决方案