今天学习浏览器模拟,把云端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. Help Me Escape ZOJ - 3640

    Background     If thou doest well, shalt thou not be accepted? and if thou doest not well, sin lieth ...

  2. 题解-洛谷P1601 A+B Problem(高精)

    https://www.luogu.org/problemnew/show/P1601(题目传送) 显然数据范围超过了long long类型,故不能简单的用两个长整型存起来相加.这里用到大数据的高精度 ...

  3. 给react-native添加图标和启动屏

    react native 项目默认是没有图标,并且启动页面只有文字.这个样子并不能算是一个完整的APP,现在就给APP加一个图标和一个适应所有屏幕尺寸的启动图,并且设置启动图遮住项目启动时候的白色闪屏 ...

  4. GWAS群体分层 (Population stratification):利用plink对基因型进行PCA

    一.为什么要做祖先成分的PCA? GWAS研究时经常碰到群体分层的现象,即该群体的祖先来源多样性,我们知道的,不同群体SNP频率不一样,导致后面做关联分析的时候可能出现假阳性位点(不一定是显著信号位点 ...

  5. Ubuntu18.04 安装32bit库后出现问题

    ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared ob ...

  6. Java斗地主案例、异常和自定义异常整理

    模拟斗地主洗牌发牌 1.1 案例介绍 按照斗地主的规则,完成洗牌发牌的动作. 具体规则: 1. 组装54张扑克牌 2. 将54张牌顺序打乱 3. 三个玩家参与游戏,三人交替摸牌,每人17张牌,最后三张 ...

  7. kubernetes云平台管理实战: 高级资源deployment-滚动升级(八)

    一.通过文件创建deployment 1.创建deployment文件 [root@k8s-master ~]# cat nginx_deploy.yml apiVersion: extensions ...

  8. 运维工作笔记——基于centos7.3的多台服务期时间同步

    1. 确认服务器版本 2.查看本机时间 3.可以同过date进行时间更改 4.yum安装ntp服务(服务端与客户端都需要安装)       yum install -y ntp 5.在服务端192.1 ...

  9. iTOP-4418开发板Qt系统下运行摄像头测试程序

    编译环境:Ubuntu 12.04 交叉编译工具链:gcc 4.4.1 一.添加编译器的环境变量 打开~/.bashrc文件,修改环境变量,如下图:   修改完后,更新环境变量,使用命令”source ...

  10. js打印WEB页面内容代码大全

    第一种方法:指定不打印区域 使用CSS,定义一个.noprint的class,将不打印的内容放入这个class内. 详细如下: <style media=print type="tex ...