Problem:
$ yum
File "/usr/bin/yum", line 30
Except Keyboardinterrupt, E:
^
Syntaxerror:invalid syntax
Reason:
This is because Yum uses Python as the command interpreter, which can be found from the first line of the/usr/bin/yum file #!/usr/bin/python. Compatibility between Python versions is not very good, making 2. There is a syntax inconsistency between version X and version 3.0. And the CentOS 5 comes with Yum with python2.7, and when the system upgrades Python to 3.0, there is a syntax explanation error.
Workaround:
Very simple, one is to upgrade Yum, one is to modify the Yum interpreter for the old version of python2.7 (if you are not using overwrite upgrade).
The practice of upgrading Yum is not detailed. Modify the Yum interpreter for the old version python2.7:
$ vi/usr/bin/yum
Change the first line "#!/usr/bin/python" to "#!/usr/bin/python2.7".
Yum exception from Python upgrade: File "/usr/bin/yum", line 30