Linux下使用yum install時出現Exiting on user cancel
有時使用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