码迷,mamicode.com
首页 > 系统相关 > 详细

Linux下使用yum install时出现Exiting on user cancel

时间:2019-01-17 23:52:09      阅读:818      评论:0      收藏:0      [点我收藏+]

标签:pytho   proc   sqlite   无法安装   wrong   not   解决方法   word   col   

有时使用yum install时会出现如下错误,导致软件无法安装。

Loaded plugins: fastestmirror
Cleaning repos: base epel extras mysql-connectors-community mysql-tools-community
: mysql56-community updates
14 metadata files removed
0 sqlite files removed
0 metadata files removed
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 3.4 kB 00:00:00
mysql-connectors-community | 2.5 kB 00:00:00
mysql-tools-community | 2.5 kB 00:00:00
mysql56-community | 2.5 kB 00:00:00
updates | 3.4 kB 00:00:00
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax


Exiting on user cancel

这个yum的一个bug,解决的办法是修改/usr/lib/python2.7/site-packages/urlgrabber/grabber.py文件。

elif errcode == 42:
  # this is probably wrong but ultimately this is what happens
  # we have a legit http code and a pycurl ‘writer failed‘ code
  # which almost always means something aborted it from outside
  # since we cannot know what it is -I‘m banking on it being
  # a ctrl-c. XXXX - if there‘s a way of going back two raises to
  # figure out what aborted the pycurl process FIXME
  raise KeyboardInterrupt

修改后:

#elif errcode == 42:
  # this is probably wrong but ultimately this is what happens
  # we have a legit http code and a pycurl ‘writer failed‘ code
  # which almost always means something aborted it from outside
  # since we cannot know what it is -I‘m banking on it being
  # a ctrl-c. XXXX - if there‘s a way of going back two raises to
  # figure out what aborted the pycurl process FIXME
  #raise KeyboardInterrupt

然后切换到root用户,执行以下命令:

yum clean metadata

yum clean all

yum upgrade

执行完后,重新执行安装命令,大多数人应该都解决了,但是博主运气较差,并没有解决。

后来各种鼓捣,又修改了/usr/bin/yum文件,将第一行修改为如下内容:

#!/usr/bin/python2

但是新问题又来了:

[root@iz2ze3g36wzfbgvzqas89uz conf]# yum -y install php
  File "/usr/bin/yum", line 30
    except KeyboardInterrupt, e:
                                            ^
SyntaxError: invalid syntax

解决方法就是,修改/usr/libexec/urlgrabber-ext-down文件,将第一行修改为如下内容:

#! /usr/bin/python2

至此,终于可以愉快的安装软件了。

Linux下使用yum install时出现Exiting on user cancel

标签:pytho   proc   sqlite   无法安装   wrong   not   解决方法   word   col   

原文地址:https://www.cnblogs.com/feilstar/p/10284890.html

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