yum工具使用报错 File “/usr/libexec/urlgrabber-ext-down“, line 22, in <module>)

yum工具使用报错 File "/usr/libexec/urlgrabber-ext-down", line 22, in

现象

使用yum命令时报如下错误:
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com
    base | 3.6 kB 00:00:00
    extras | 2.9 kB 00:00:00
    updates | 2.9 kB 00:00:00
    Traceback (most recent call last):
    File “/usr/libexec/urlgrabber-ext-down”, line 22, in
    from urlgrabber.grabber import
    ImportError: No module named urlgrabber.grabber
    Traceback (most recent call last):
    File “/usr/libexec/urlgrabber-ext-down”, line 22, in
    from urlgrabber.grabber import
    ImportError: No module named urlgrabber.grabber

由于用户取消而退出

解决方法

原因为python升级后版本不一致导致,需修改如下
vim /usr/libexec/urlgrabber-ext-down,首行python版本改为python2.7
原始文件:

#! /usr/bin/python
#  A very simple external downloader
#  Copyright 2011-2012 Zdenek Pavlas

#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU Lesser General Public
#   License as published by the Free Software Foundation; either
#   version 2.1 of the License, or (at your option) any later version.
#
#   This library is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   Lesser General Public License for more details.

修改后:

#! /usr/bin/python2.7
#  A very simple external downloader
#  Copyright 2011-2012 Zdenek Pavlas

#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU Lesser General Public
#   License as published by the Free Software Foundation; either
#   version 2.1 of the License, or (at your option) any later version.
#
#   This library is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   Lesser General Public License for more details.

再运行yum命令即可正常使用

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值