今天在使用yum的時候報錯:
[root@localhost /]# yum File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxError: invalid syntax
原來是自己前幾天安裝了Python 3.5
根據提示,解決方法:
[root@localhost /]# vim /usr/bin/yum #!/usr/bin/python import sys try: import yum except ImportError: print >> sys.stderr, """\
將上面語句改成系統之前默認python2.6的版本:
#!/usr/bin/python2.6 import sys try: import yum except ImportError: print >> sys.stderr, """\
yum 就可以使用了