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