Yum exception from Python upgrade: File "/usr/bin/yum", line 30

Source: Internet
Author: User

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. The CentOS 5 comes with Yum with python2.4, and when the system upgrades Python to 2.6 or 3.0, a syntax explanation error occurs.

Workaround:

Very simple, one is to upgrade Yum, one is to modify the Yum interpreter for the old version of python2.4 (if you are not using overwrite upgrade).

The practice of upgrading Yum is not detailed. Modify the Yum interpreter for the old version python2.4:

$ vi/usr/bin/yum

Change the first line "#!/usr/bin/python" to "#!/usr/bin/python2.4".

Yum exception from Python upgrade: File "/usr/bin/yum", line 30

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.