yum 与 python版本冲突

高gao 发布于 2017/07/07 10:04
阅读 1K+
收藏 0

我安装了python2.7之后,使用yum的时候发生错,信心如下

[gao@localhost ~]$ yum update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named rpm

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, Jul  6 2017, 15:53:10)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

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

查看python的版本信息如下:

[root@localhost gao]# whereis python
python: /usr/bin/python2.7 /usr/bin/python /usr/bin/python2.7-config /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /usr/share/man/man1/python.1.gz /usr/share/man/man1/python.1 /usr/share/man/man1/python2.1

网上查的是把/usr/bin/yum里面的/usr/bin/python改成/usr/bin/python2.7还是不行。

linux菜鸟求各位大神指点

 

加载中
0
polly
polly

原来的python备份了么?正确的姿势是安装之前备份:

mv /usr/bin/python /usr/bin/python26

安装完后擦屁股:

# vi /usr/bin/yum

 

将文件头部的

#!/usr/bin/python

改成

#!/usr/bin/python26

0
ptrees
ptrees

yum要用python2.6

0
高gao
高gao

引用来自“polly”的评论

原来的python备份了么?正确的姿势是安装之前备份:

mv /usr/bin/python /usr/bin/python26

安装完后擦屁股:

# vi /usr/bin/yum

 

将文件头部的

#!/usr/bin/python

改成

#!/usr/bin/python26

没有备份,那我在安装一个python2.6试试。

返回顶部
顶部