CentOS yum No module named urlgrabber报错解决方案

我的环境版本信息如下:

CentOS release 6.10 (Final)


执行任何yum命令都出现错误:yum No module named urlgrabber,详细错误信息如下;

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named urlgrabber

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.5 (default, Feb 11 2014, 07:46:25) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-13)]

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

 原因大概是在安装了多个版本的python后造成的

解决办法:重新安装urlgrabber的rpm包即可

操作步骤:

1:卸载现有的urlgrabber包(如果存在)

# 查看是否已安装urlgrabber,笔者的是python-urlgrabber-3.9.1-11.el6.noarch这个版本
rpm -qa | grep urlgrabber 

# 卸载python-urlgrabber-3.9.1-11.el6.noarch
rpm -e --nodeps python-urlgrabber-3.9.1-11.el6.noarch

 

 2:在官网下载对应版本的urlgrabber包

curl -O http://mirror.centos.org/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm

3:重新安装下载好的urlgrabber

rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm

4:如果安装urlgrabber出现如下错误(没有则忽略)

error: Failed dependencies:
	python-pycurl is needed by python-urlgrabber-3.9.1-11.el6.noarch


# 需要安装python-pycurl.rpm包,从这里下载

wget http://mirror.centos.org/centos/6/os/x86_64/Packages/python-pycurl-7.19.0-9.el6.x86_64.rpm

# 安装python-pycurl包

rpm -ivh python-pycurl-7.19.0-9.el6.x86_64.rpm

最后,重新使用yum即可

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值