Python uninstall mode and run Yum Error: No module named Yum

Source: Internet
Author: User

Company test machine Environment do not know what to unload my package, resulting in Yum run error status:

System version: Red Hat Enterprise Linux Server Release 6.2 (Santiago)

Kernel version: 2.6.32-220.el6.x86_64

Error situation:

There was a problem importing one of the Python modules
Required to run Yum. The error leading to this problem was:

No module named SQLite

Install a package which provides this module, or
Verify the module is installed correctly.

It ' s possible that the above module doesn ' t match the
Current version of Python, which is:

One, upgrading or uninstalling Python causes:

12345678 1、查看已安装python的版本,可能是当前系统存在多个python导致[[email protected]test~]# whereis pythonpython: /usr/bin/python2.6 /usr/bin/python/usr/bin/python2.6-config /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /usr/share/man/man1/python.1.gz[[email protected]test~]# vi /usr/bin/yum将 #!/usr/bin/python 修改为 #!/usr/bin/python2.6如果是源代码安装的,默认路径是/usr/local/bin/python2.6,做个软链接即可rm-rf /usr/bin/pythonln-s /usr/local/bin/python2.6 /usr/bin/python

Second, completely reload Python and Yum

123456789101112131415161718192021222324252627 1、删除现有Python[[email protected]test~]# rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps ##强制删除已安装程序及其关联[[email protected]test ~]# whereis python |xargs rm -frv ##删除所有残余文件 ##xargs,允许你对输出执行其他某些命令[[email protected]test~]# whereis python ##验证删除,返回无结果2、删除现有的yum[[email protected]test~]# rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps[[email protected]test~]# whereis yum |xargs rm -frv3、从http://mirrors.ustc.edu.cn/centos/6.4/os/x86_64/Packages/下载相应的包python-2.6.6-36.el6.x86_64.rpmpython-devel-2.6.6-36.el6.x86_64.rpmpython-libs-2.6.6-36.el6.x86_64.rpmpython-pycurl-7.19.0-8.el6.x86_64.rpmpython-setuptools-0.6.10-3.el6.noarch.rpmpython-urlgrabber-3.9.1-8.el6.noarch.rpm  python-iniparse-0.3.1-2.1.el6.noarch.rpmrpm-python-4.8.0-32.el6.x86_64.rpmyum-3.2.29-40.el6.centos.noarch.rpmyum-metadata-parser-1.1.2-16.el6.x86_64.rpmyum-utils-1.1.30-14.el6.noarch.rpmyum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm     yum-plugin-protectbase-1.1.30-14.el6.noarch.rpmyum-plugin-aliases-1.1.30-14.el6.noarch.rpmyum-plugin-downloadonly-1.1.30-14.el6.noarch.rpm由于源中版本会更新,具体请查看URL中的版本再下载下来![[email protected]test ~]# rpm -Uvh --replacepkgs python*.rpm[[email protected]test~]# rpm -Uvh --replacepkgs rpm-python*.rpm yum*.rpm可能之间还需要zlib和zlib-devel包,根据情况下载并安装!

Third, run Python to test

1234567 [[email protected]test~]# pythonPython 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2Type "help""copyright""credits"or "license"formoreinformation.>>> importyum>>>如上,要是什么都没报,则说明OK啦~
Source: http://blog.51cto.com/smilepad/1333478

Python uninstall mode and run Yum Error: No module named Yum

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.