An error was reported when using Yum today:
[root@localhost /]# yum File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxError: invalid syntax
It turned out that I installed Python 3.5 a few days ago
According to the prompt, the solution:
[root@localhost /]# vim /usr/bin/yum #!/usr/bin/python import sys try: import yum except ImportError: print >> sys.stderr, """\
Change the above statement to the default version of python2.6 before the system:
#!/usr/bin/python2.6 import sys try: import yum except ImportError: print >> sys.stderr, """\
yum can be used
:
Similar Posts:
- How to use htmltestrunner.py to report importerror: no module named ‘stringio’ in Python 3
- [Solved] ImportError: cannot import name pywrap_tensorflow
- How to Solve Centos Yum Error: No module named yum
- ImportError: No module named ‘requests’
- How to Solve pip3 ImportError: cannot import name ‘main’
- Handling method of PIP error in pycharm installation
- [Solved] pytorchImportError: numpy.core.multiarray failed to import
- [Solved] yum Execute Error: -bash: /usr/bin/yum: /usr/bin/python3.7: bad interpreter: No such file or directory
- [Solved] peewee error: ImportError: No module named ‘MySQLdb’;pymysql error: from . import connections # noqa: E402
- Python3.x Run Python2.x Codes syntax error: “Missing parentheses in call to ‘print’