Centos7 中yum命令无法执行

报错:

**/usr/bin/yum: line 3: import: command not found

/usr/bin/yum: line 4: try:: command not found

/usr/bin/yum: line 5: import: command not found

/usr/bin/yum: line 6: except: command not found

/usr/bin/yum: line 24: syntax error near unexpected token `('

/usr/bin/yum: line 24: `""" % (sys.exc_value, sys.version)'**


原因:升级python3导致

解决方式:

修改文件/usr/bin/yum、头中相应python为#!/usr/bin/python2.7

推荐阅读更多精彩内容