码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-09-11 23:54:47      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:rpm   centos6   problem   查看   this   错误   ada   error   nload   

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

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

标签:rpm   centos6   problem   查看   this   错误   ada   error   nload   

原文地址:http://blog.51cto.com/moerjinrong/2173963

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!