centos7 yum安装python3无法使用yum解决办法
昨天帮朋友在阿里云上安装python3,原本以为很简单的事情,居然让我搞了半天.
系统:centos 7(64位)
软件环境:python3
1.安装yum源
yum -y install epel-release
2.安装python3
yum -y install python34 python34-pip
替换python2.7
rm -f /usr/bin/python
ln -sf /usr/bin/python3 /usr/bin/python
3.修改yum
vim /usr/bin/yum
将顶部的
#!/usr/bin/python
修改为:
#!/usr/bin/python2.7
原本以为改了这里就可以了,没想到再执行yum居然报下面的错误:
[root@rocdk890 ~]#yum -y install iftop
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* elrepo: mirrors.thzhost.com
base | 3.6 kB 00:00:00
elrepo | 2.9 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 3.4 kB 00:00:00
mysql-connectors-community | 2.5 kB 00:00:00
mysql-tools-community | 2.5 kB 00:00:00
mysql56-community | 2.5 kB 00:00:00
updates | 3.4 kB 00:00:00
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
Exiting on user cancel
网上搜了下,修改/usr/libexec/urlgrabber-ext-down里的#! /usr/bin/python为#! /usr/bin/python2.7就可以解决.
ps:
http://www.cnblogs.com/linkxu1989/p/6955137.html
评论: