今天学习浏览器模拟,把云端centos上的python2.7升级到3.6,但是安装其他软件时发现报如下错误:

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

此问题原因是系统默认安装文件等需要调用python2.7,执行文件的第一行是#!/usr/bin/python,这样在装了3.6之后就会默认调用3.6了,而不是原来默认的2.7了,

解决方法:

修改yum配置文件,将python版本指向以前的旧版本

# vi /usr/bin/yum
#!/usr/bin/python2.

修改urlgrabber-ext-down文件,更改python版本

# vi /usr/libexec/urlgrabber-ext-down
#!/usr/bin/python2.

centos升级python2.7到3.6之后造成yum命令报错的更多相关文章

  1. Centos下使用yum命令报错 except KeyboardInterrupt, e: SyntaxError: invalid syntax

    使用yum命令报错 File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxError: invalid ...

  2. CentOS yum命令报错 Error: File /var/cache/yum/i386/6/epel/metalink.xml does not exist

    最近在虚拟机上执行yum命令一直报错:Could not parse metalink https://mirrors.fedoraproject.org/metalink?repo=epel-7&a ...

  3. centos yum命令报错

    Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile Could not retriev ...

  4. Centos——升级Python2.7及安装pip

    CentOS升级Python2.7及安装pip 1) 升级Python2.7 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ...

  5. centos在yum install报错:Another app is currently holding the yum lock解决方法

    centos在yum install报错:Another app is currently holding the yum lock,这个问题可能是很多的新手经常遇到问题,之前也有人问我,包括本人在刚 ...

  6. 同时安装Python2与Python3,安装第三方包,老是报错

    同时安装Python2与Python3,安装第三方包,老是报错提示Fatal error in launcher: Unable to create process using '"',那可 ...

  7. python2中的unicode()函数在python3中会报错:

    python2中的unicode()函数在python3中会报错:NameError: name 'unicode' is not defined There is no such name in P ...

  8. CentOS升级Python2.6到Python2.7并安装pip

    原文:http://ruter.sundaystart.net/2015/12/03/Update-python/ 貌似CentOS 6.X系统默认安装的Python都是2.6版本的?平时使用以及很多 ...

  9. CentOS升级Python2.6到Python2.7

    个人博客:https://blog.sharedata.info/ 貌似CentOS 6.X系统默认安装的Python都是2.6版本的?平时使用以及很多的库都是要求用到2.7版本或以上,所以新系统要做 ...

随机推荐

  1. 题解:[APIO/CTSC 2007]数据备份

    你在一家 IT 公司为大型写字楼或办公楼(offices)的计算机数据做备份.然而数据备份的工作是枯燥乏味的,因此你想设计一个系统让不同的办公楼彼此之间互相备份,而你则坐在家中尽享计算机游戏的乐趣.已 ...

  2. (一)Qt5模块,QtCreator常用快捷键,命名规范

    常用快捷键 1)帮助文件:F1 (光标在函数名字或类名上,按 F1 即可跳转到对应帮助文档,查看其详细用法) 2).h 文件和对应.cpp 文件切换:F4 3)编译并运行:Ctrl + R 4)函数声 ...

  3. 【GDOI2016模拟3.15】基因合成(回文串+性质+DP)

    [GDOI2016模拟3.15]基因合成 题意: 给一个目标串,要求从空串进行最少的操作次数变成目标串,操作有两种: 在串的头或尾加入一个字符. 把串复制一遍后反向接到串的末尾. 因为有回文操作,所以 ...

  4. Python 文件读取

    1. 最基本的读文件方法: # File: readline-example-1.py file = open("sample.txt") while 1: line = file ...

  5. Fiddler--AutoResponder

    AutoResponder支持创建规则,可以在响应请求时自动触发,常见例子是返回之前捕捉的响应,而不需要访问服务器. 通俗点讲,就是它能在不访问服务器的情况下,使发送的请求得到自己设置的响应. 下图是 ...

  6. springboot2 pagehelper 使用笔记

    作者:cnJun 博客专栏: https://www.cnblogs.com/cnJun/ pom.xml <parent> <groupId>org.springframew ...

  7. webpack 代码优化压缩方法

    在配置基于webpack的react单页面脚手架时,公共依赖库代码打包至vender.js中,页面逻辑代码打包至app.js中,使用webpack-bundle-analyzer分析发现,两个js中包 ...

  8. luogu P5289 [十二省联考2019]皮配

    传送门 首先考虑一个正常的dp,设\(f_{i,j,k}\)为前\(i\)个学校,\(j\)人在\(\color{#0000FF}{蓝阵营}\),\(k\)人在\(\color{#654321}{吔} ...

  9. thymeleaf : input/select/radio回显

    thymeleaf中不用自己去写checked="checked" selected="selected"这种代码,他自己会选. input <input ...

  10. 【Java编程思想笔记】注解1-简单了解注解

    文章参考:https://www.cnblogs.com/xuningchuanblogs/p/7763225.html https://www.cnblogs.com/xdp-gacl/p/3622 ...