File "/bin/yum", line 30 except KeyboardInterrupt, e: SyntaxError: invalid syntax 报错的解决

yum安装包的报错信息如下:

[root@iZb3kuz33l2fzfZ ~]# yum install screen -y
  File "/bin/yum", line 30
    except KeyboardInterrupt, e:
                            ^
SyntaxError: invalid syntax

File "/bin/yum", line 30  except KeyboardInterrupt, e: SyntaxError: invalid syntax  报错的解决

 

 

是因为默认python命令版本被替换成了3.x,要更改yum的执行继续使用老版的2.x

1、使用whereis python2.7命令找到python2.7的路径

File "/bin/yum", line 30  except KeyboardInterrupt, e: SyntaxError: invalid syntax  报错的解决

 

 2、编辑/bin/yum文件,修改第一行,添加2.7,保存重新执行yum

File "/bin/yum", line 30  except KeyboardInterrupt, e: SyntaxError: invalid syntax  报错的解决

 

执行还是有报错,继续编辑这个文件,同样添加2.7:

File "/bin/yum", line 30  except KeyboardInterrupt, e: SyntaxError: invalid syntax  报错的解决

 

 

File "/bin/yum", line 30  except KeyboardInterrupt, e: SyntaxError: invalid syntax  报错的解决

 

 

再次执行OK了

File "/bin/yum", line 30  except KeyboardInterrupt, e: SyntaxError: invalid syntax  报错的解决

 

 

参考:

使用yum命令报错File "/usr/bin/yum", line 30 except KeyboardInterrupt, e:_zsl10的专栏-CSDN博客

上一篇:迭代器(iterators)


下一篇:STL源码笔记