Python upgrade causes Yum to not work properly

Source: Internet
Author: User

First, the problem description

When I installed Django yesterday, some commands do not work, a check should be the Python version is too low, the current version 2.6.6, so the compilation installed 2.7.2, compiled after the completion of a soft connection added to the path path, the Python calls the 2.7 version. But the problem comes, when using Yum, the error can not be used, the module cannot be found.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/75/0D/wKioL1YxtXWAGD0eAAIslGyikf0459.jpg "title=" Clipboard.png "alt=" Wkiol1yxtxwagd0eaaislgyikf0459.jpg "/>

[[email protected] ~]# yumthere was 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 that the module is installed correctly. It ' S POSSIBLE THAT THE ABOVE MODULE DOESN ' t match thecurrent  version of python, which is:2.7.2  (default, oct 28 2015, 14:44:54 )  [GCC 4.4.7 20120313  (red hat 4.4.7-16)]if you cannot solve  this problem yourself, please go to the yum faq at:   http://yum.baseurl.org/wiki/faq 

This time it shows that Yum can't be used.

Ii. Solutions

So I looked up the reason on the Internet, know is the Python upgrade caused by the Yum call the new 2.7 version of Python, but the existing Yum version of the Python is not high

1. View Yum version

[Email protected] ~]# Rpm-qa | grep yumyum-metadata-parser-1.1.2-16.el6.x86_64 Yum-plugin-fastestmirror-1.1.30-17.el6_5. Noarchyum-plugin-security-1.1.30-17.el6_5.noarchyum-3.2.29-43.el6.centos.noarchyum-utils-1.1.30-17.el6_5. Noarch

2. View Python version

[Email protected] ~]# Whereis Pythonpython:/usr/bin/python2.6/usr/bin/python/usr/lib/python2.6/usr/lib64/ python2.6/usr/local/bin/python/usr/local/bin/python2.7-config/usr/local/bin/python2.7/usr/local/lib/python2.7/ Usr/include/python2.6/usr/share/man/man1/python.1.gz

3. Solution

Modify Yum's py file

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/75/0D/wKioL1YxuLyyfM7oAAEnRlH0vIY904.jpg "title=" 5c30.tmp.jpg "alt=" Wkiol1yxulyyfm7oaaenrlh0viy904.jpg "/>

Because the previous soft connection made the/usr/bin/python call to the 2.7 version, so here Yum uses the 2.7 version of Python, resulting in the inability to use it properly, so we need to modify the beginning of the Yum call to the 2.6 version of Python

[Email protected] ~]# sed-i ' s#/usr/bin/python#/usr/bin/python2.6#g '/usr/bin/yum

Re-check Yum

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/75/10/wKiom1YxugHD7dr5AAEHrJAAd2k045.jpg "title=" 60f9.tmp.jpg "alt=" Wkiom1yxughd7dr5aaehrjaad2k045.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/75/0D/wKioL1YxuqeRIHuaAACFjgZzZ-s385.jpg "title=" 626d.tmp.jpg "alt=" Wkiol1yxuqerihuaaacfjgzzz-s385.jpg "/>

Now Yum can use it normally.

Iii. Summary of the issues

So the problem with Yum not working properly in the end is the Python upgrade, and we just need to update Yum's files, because Yum is written in Python and is required for Python versions.

This article is from the "Chuck's blog" blog, so be sure to keep this source http://10534728.blog.51cto.com/10524728/1707676

Python upgrade causes Yum to not work properly

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.