Methods to solve the error of Yum and PIP caused by Python upgrade

Source: Internet
Author: User
This article mainly introduces to you because the Python upgrade causes Yum, pip Error Resolution method, the article through the sample code to solve the method introduced in very detailed, to everyone's study or work has a certain reference learning value, the need for friends below with the small series to learn to study under.

Objective

This article mainly introduces to you because of the Python upgrade lead to Yum, pip error of the liberation method, share out for everyone to reference the study, the following words do not say more, come together to see the detailed introduction bar.

Reason:

Yum is written in Python. The Python version on the server is too low to upgrade to 2.7, and YUM/PIP is not upgraded, resulting in the error of executing the YUM/PIP times.

Yum Error:


There is a problem importing one of the Python modulesrequired to run yum. The error leading to this problem Was:no module named Yumplease Install a package which provides this module, orverify th At the module is installed correctly. It's possible that the above module doesn ' t match thecurrent version of Python, which is:2.7.10 (default, Sep 5 2017, 17:3 5:43) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]if You cannot solve this problem yourself, click Go to the Yum FAQ at:http:/ /yum.baseurl.org/wiki/faq

PIP Error:


Traceback (most recent): File "/usr/bin/pip2", line 5, in <module> from pkg_resources import Load_entry_po Intimporterror:no module named Pkg_resources

Solution:

1. View the Python version and execute:


which Python

You can see that there are two versions of Python.

2. To view yum files, execute:


Vim/usr/bin/yum

You can see the Python reference for Yum on the first line of the file. Change the original #!/usr/bin/python to #!/usr/bin/python2.6 (old version)

3. Run out of Yum again and you can use it.

Pip similarly modified

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.