问题:
[root@192-168-12-90 software]# yum
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax
updates | 3.4 kB 00:00:00
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
原因:
yum采用python作为命令解释器,系统自带的为python2.7,我因为要安装appium,所以默认的python软链接了python3.7
解决方法:
修改/usr/bin/yum,把#!/usr/bin/python修改为#!/usr/bin/python2.7
#!/usr/bin/python2.7
import sys
try:
import yum
except ImportError:
print >> sys.stderr, """\
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
%s
Please install a package which provides this module, or
verify that the module is installed correctly.
#修改/usr/libexec/urlgrabber-ext-down,把python改为python2.7
vim /usr/libexec/urlgrabber-ext-down
#! /usr/bin/python2.7
# A very simple external downloader
# Copyright 2011-2012 Zdenek Pavlas
#改完后,重新使用yum安装,就不会报错了
--------------end----------------