Resolve the dependent version of yum on python
- 2021-07-09 08:58:12
- OfStack
Errors
# yum list
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax
Solution
1 is to upgrade yum.
2 is to modify the interpreter of yum to the old version of python 2.7, that is, to connect the file/usr/bin/python back to/usr/bin/python2.7. It is not recommended to treat the symptoms but not the root causes.
3 is to change the interpreter settings in the settings, that is, modify the/usr/bin/yum file to specify python2.7 as the interpreter of yum:
# vi /usr/bin/yum
Set line 1 "#! /usr/bin/python "read" #! /usr/bin/python2 ".
Another error will appear when installing the software
Downloading packages:
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
The problem is the same as the previous one, so the solution is also the same:
# vi /usr/libexec/urlgrabber-ext-down
Set line 1 "#! /usr/bin/python "read" #! /usr/bin/python2 ".