[已解决]yum module doesn't match th

2018-08-15  本文已影响0人  11的雾

更新了python后,yum无法使用。

$ 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.15 |Anaconda, Inc.| (default, May  1 2018, 23:32:55)

[GCC 7.2.0]

If you cannot solve this problem yourself, please go to

the yum faq at:

  http://yum.baseurl.org/wiki/Faq

看了一下python

$ python
Python 2.7.15 |Anaconda, Inc.| (default, May  1 2018, 23:32:55)
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

我安装的python是anaconda中的python,直接将python替换掉/usr/bin/python,所以
默认的python是conda中的python,导致现在yum的时候会报错。试了一下网上说的修改/usr/bin/yum 中第一行
#!/usr/bin/python的方法,行不通。
看看yum版本

$ rpm -q yum
yum-3.4.3-154.el7.centos.noarch
image.png

重新装了个python2.6
再将
vi /usr/bin/yum
第一行修改为 /usr/local/bin/python
还没有成功,

重新装yum吧,下载了四个python相关的rpm,重新装一下,

rpm -ivh --force python-tools-2.7.5-68.el7.x86_64.rpm python-2.7.5-68.el7.x86_64.rpm python-libs-2.7.5-68.el7.x86_64.rpm tkinter-2.7.5-68.el7.x86_64.rpm

这里一定要加 --force参数,
然后yum就可以运行了

上一篇下一篇

猜你喜欢

热点阅读