ijava学习网> 知识分享> Linux> CentOS 6.* 运行yum报错:No module named rpm

CentOS 6.* 运行yum报错:No module named rpm

时间: 2019-01-19 15:02:10 标签centos6 , 运行 , yum , 报错

1. 使用yum安装软件时,报如下错误:

[root@node1 ~]# yum install lrzsz    
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.6.6 (r266:84292, Jul 23 2015, 15:22:56) 
[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

[root@node1 ~]# 

2. 查看yum指向的python是否为2.6.6

[root@node1 ~]# head -1 /usr/bin/yum
#!/usr/bin/python2.6
[root@node1 ~]# ll /usr/bin/python2.6
-rwxr-xr-x 1 root root 4864 7月  24 2015 /usr/bin/python2.6
[root@node1 ~]# /usr/bin/python2.6 --version
Python 2.6.6
[root@node1 ~]# 

3. 如果yum不是指向python2.6.6:

修改yum指向到python2.6.6

[root@node1 ~]# vim /usr/bin/yum

# 测试
[root@node1 ~]# yum install lrzsz

4. 如果yum指向的是2.6.6:

则说明centos6.*的python2.6.6损坏,通过rpm重装python2.6.6,须到官网下载指定版本的包:
官网:http://vault.centos.org/6.8/os/x86_64/Packages/

需下载的包:

python
python-iniparse
python-pycurl
python-urlgrabber
python-devel
python-libs
python-setuptools
rpm-python

安装下载的rpm包:

[root@node1 ~]# rpm -ivh *rpm

# 测试yum是否可用
[root@node1 ~]# yum install lrzsz

5. 如果yum不可用,重装yum包。

# 需下载的包:
yum 
yum-metadata-parser 
yum-utils 
yum-plugin-fastestmirror 
yum-plugin-protectbase 
yum-plugin-aliases 
yum-plugin-downloadonly

# 安装
rpm -ivh yum*

# 测试
[root@node1 ~]# yum install lrzsz

版权说明| 关于ijava| 合作伙伴| 联系我们| 网站地图| 招贤纳士

Copyright © 2017 www.ijava.com All Rights Reserved 版权所有•ijava学习网 京ICP备14061482号-18         官方QQ:3325669927

ijava学习网提供免费java教程和大量java面试题库,给高级会员提供免费的java培训,同时提共一些java开发项目和java下载,java工程师,java菜鸟们快来哦。记住我们的网站:www.ijava.com