File "/usr/bin/yum", line
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax

解决步骤:

#vi /usr/bin/yum

将#!/usr/bin/python改为#!/usr/bin/python2.7

退出保存

相关错误:

【https://linuxconfig.org/how-to-switch-between-python-versions-on-fedora-linux】

Similarly: Error message:

Downloading packages:
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
Exiting on user cancel

The issue is also related to Python 3 set as a default global version. To fix this error update /usr/libexec/urlgrabber-ext-down script:

# vi /usr/libexec/urlgrabber-ext-down
FROM:
#!/usr/bin/python
TO:
#!/usr/bin/python2.7

CentOS python升级到3.5时yum报错的更多相关文章

  1. Centos中Python升级为3.X时yum出现except OSError, e: ^ SyntaxError: invalid syntax问题 No module named 'pip._internal.main

    CentOS 7升级Python到3.7.2后,需要在/usr/bin/python创建了一个指向Python 3的软连接,然后将/usr/bin/yum的顶部的: !/usr/bin/python ...

  2. python的卸载方式和运行yum报错:No module named yum

    公司测试机环境不知道给我卸了什么包,导致yum运行报错状况: 系统版本:Red Hat Enterprise Linux Server release 6.2 (Santiago) 内核版本:2.6. ...

  3. [解决] [centOS] g++ 带 -static 参数编译时,报错 /usr/bin/ld: cannot find -lm

    静态编译时缺少某个库 yum install glibc-static 从这里找到的 http://www.linuxquestions.org/questions/linux-software-2/ ...

  4. Pycharm,Python 安装OpenCV and CV2 时,报错,教你如何正确安装。

    Collecting cv2 Could not find a version that satisfies the requirement cv2 (from versions: ) No matc ...

  5. python中发送post请求时,报错“Unrecognized token 'xxxx': was expecting ('true', 'false' or 'null')”

    解决办法: 如请求参数为 data={“user”=“aaa”,“pwd”=“123456”,sign=“00000000000000”} 需要将参数data先做处理,调用函数datas=datajs ...

  6. 升级python导致yum报错的解决方法

    把python从2.7升级到3.6后 , 使用yum报错 File ‘’/usr/bin/yum'', line 30 except KeyboardInterrupt, e: ^ 故障原因:yum采 ...

  7. CentOS命令登录MySQL时,报错ERROR 1045 (28000):

    CentOS命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)错误解 ...

  8. centOS下yum报错

    CentOS下yum报错 备注:当我们在CentOS下使用yum命令的时候,会报一些错误,一下是我总结的几个解决问题的方法.(保证自己的服务器可以上网) 一.关于Loaded plugins: fas ...

  9. Linux—运行yum报错:No module named yum

    产生原因:yum基于python写的,根据报错信息提示,是yum的python版本对应不上目前python环境的版本导致的.也就是说 有人升级或者卸载了python. 解决方式: # 查看yum版本 ...

随机推荐

  1. CentOS5、6 NFS的安装配置及mount方法

    一.环境介绍: 服务器:centos 192.168.1.225 客户端:centos 192.168.1.226 二.安装: NFS的安装配置:centos 5 : yum -y install n ...

  2. Oracle中忘记sys和System密码的办法

    打开cmd:sqlplus/nolog connect/as sysdba; alter user sys identified by ***; alter user system identifie ...

  3. CKeditor 集成 CKFinder

    之前照着网上的做,遇到了一些问题,经过多次实验修改最后算是成功了,下面进行详细讲解. 一.CKeditor的配置(附件中已有最新版CKeditor和CKFinder) 1.需要下载ckeditor, ...

  4. 基于easyui的webform扩展(续)

    基于easyui的webform扩展(续) 回顾 <前端基于easyui的mvc扩展>.<前端基于easyui的mvc扩展(续)>.<基于easyui的webform扩展 ...

  5. .net postsharp编译时生成的代码?

    使用PostSharp进行AOP框架设计:一个简单的原型   AOP已经不是一个什么新名词了,在博客园使用关键字搜索可以查出n多条关于AOP的介绍,这里就不再赘述了. 在Bruce Zhang's B ...

  6. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第五章:排序、分页和路由

    本章的重点是对产品信息增加排序和分页的功能,以及使用ASP.NET Routing特性添加更加友好的URL支持. 注意:如果你想按照本章的代码编写示例,你必须完成第四章或者直接从www.apress. ...

  7. oracle表空间表分区详解及oracle表分区查询使用方法(转+整理)

    欢迎和大家交流技术相关问题: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://g ...

  8. 利刃 MVVMLight 1:MVVMLight介绍以及在项目中的使用

    一.MVVM 和 MVVMLight介绍 MVVM是Model-View-ViewModel的简写.类似于目前比较流行的MVC.MVP设计模式,主要目的是为了分离视图(View)和模型(Model)的 ...

  9. Js-Html 前端系列--全选,反选

    /* 全选 */ $("#selectedAll").click(function(){ var boxcList = $(".boxc");var boxcL ...

  10. [ios2]如何让IOS应用从容地崩溃 【转】

    文/donglin 虽然大家都不愿意看到程序崩溃,但可能崩溃是每个应用必须面对的现实,既然崩溃已经发生,无法阻挡了,那我们就让它崩也崩得淡定点吧. IOS SDK中提供了一个现成的函数 NSSetUn ...