Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3255026
  • 博文数量: 515
  • 博客积分: 5116
  • 博客等级: 大校
  • 技术积分: 4137
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-30 11:24
个人简介

黑马王子就是我! 技术认证:系统分析师,网络规划设计师,网络工程师,信息系统监理师,系统集成项目管理师,初级程序员,MCSE,MCDBA,CCNA 目前主攻虚拟化技术,VPN,系统架构,集群和高可用性等。

文章分类

全部博文(515)

文章存档

2023年(11)

2022年(17)

2021年(19)

2020年(28)

2019年(42)

2018年(53)

2017年(41)

2016年(33)

2015年(43)

2014年(25)

2013年(13)

2011年(6)

2010年(28)

2009年(47)

2008年(55)

2007年(26)

2006年(28)

分类: Python/Ruby

2020-07-08 15:14:28

错误:

[root@MyServer face.dl520.net]# sudo yum install epel-release -y
  File "/usr/bin/yum", line 30
    except KeyboardInterrupt, e:

原因:


这是因为yum采用python作为命令解释器,原来系统自带的python解释器为python2.7,然后我之前为了方便将python默认的解释器设为了python3.6,导致按python3.6解析2.7的语法出错了。


解决方法:


修改/usr/bin/yum文件中的第一行为#!/usr/bin/python2.7

#!/usr/bin/python2.6
import sys
try:
    import yum
except ImportError:
    print >> sys.stderr, """\


可能你的系统不是2.7,通过tab键补全python命令就可以看到你有哪些python版本,选一个低版本的就好。

[root@MyServer face.dl520.net]# python
python             python2.6          python3            python3.5-config   python3.5m-config  python-config      
python2            python2.6-config   python3.5          python3.5m         python3-config     



修改之后就可以正常使用yum了。

[root@MyServer bin]# sudo yum install epel-release -y
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                         | 3.0 kB     00:00     
 * base: hk.mirrors.thegigabit.com
 * epel: mirror.telkomuniversity.ac.id
 * extras: hk.mirrors.thegigabit.com
 * updates: hk.mirrors.thegigabit.com

阅读(6492) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~