[Linux]centos7 "No module named yum" Error after upgrading Python

Source: Internet
Author: User

After the company server reinstall the system, manually upgrade the python2.7.5 to 2.7.15, the installation of Python in the process of updating the system Python version of the system did not inadvertently delete the version, resulting in the implementation of the Yum command when the error occurred

There is a problem importing one of the Python modulesrequired to runYum. The error leading to this problem Was:no module namedYum pleaseInstallA packagewhichprovides this module, orverify the module is installed correctly. It's possible that the above module doesn'T match thecurrent version of Python,whichis :2.7. the(Default, May + 2018, One: +: -) [GCC4.8.5 20150623(Red Hat4.8.5- -)]if cannot solve this problem yourself, please go totheYumFAQ at:http://Yum.baseurl.org/wiki/faq

This problem occurs after you manually compile and install the python2.7.5 version, considering that the Python version used by the original system is 2.7.5.

Workaround:

Download the following files: Python-2.4.3- $. El5_8.2. I386.rpmpython-devel-2.4.3- $. El5_8.2. I386.rpmpython-libs-2.4.3- $. El5_8.2. I386.rpmpython-tools-2.4.3- $. El5_8.2. I386.rpmtix-8.4.0- One. Fc6.i386.rpmtix-devel-8.4.0- One. Fc6.i386.rpmtkinter-2.4.3- $. El5_8.2. i386.rpmYum-3.2. A- the. El5.centos.noarch.rpm:http://mirrors.163.com/centos/7/os/x86_64/packages/[email protected] x]#lspython-2.4.3- $. El5_8.2. i386.rpm tix-8.4.0- One. Fc6.i386.rpmpython-devel-2.4.3- $. El5_8.2. i386.rpm tix-devel-8.4.0- One. Fc6.i386.rpmpython-libs-2.4.3- $. El5_8.2. i386.rpm tkinter-2.4.3- $. El5_8.2. I386.rpmpython-tools-2.4.3- $. El5_8.2. i386.rpmYum-3.2. A- the. El5.centos.noarch.rpm[[email protected] x]# rpm-UVH--replacepkgs *. rpmpreparing. ########################################### [ -%]1: Tix ########################################### [ -%]2: Tix-devel ########################################### [ -%]3:p Ython ########################################### [ -%]4: Tkinter ########################################### [ -%]5:p Ython-devel ########################################### [ the%]6:p Ython-libs ########################################### [ the%]7:p Ython-tools ########################################### [ the%]8:Yum########################################### [ -%][[email protected] x]#YumUpdate

Update system Yum File

mv/bin/python2.7/bin/python2.7.5

# Modify the Python version referenced by the Yum file
Vim/usr/bin/yum
#!/bin/python2. 7.5 <---modified to

[linux]centos7 "No module named yum" Error after upgrading Python

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.