学习Django,并且要使用MySQL数据库。于是有一步是要安装MySQL-python 本文引用自Novell迷网站
最简单的办法是使用命令 yum install MySQL-python
内容来自http://novell.me
不料使用这命令时却报错:
CopyRight http://novell.me
- There was a problem importing one of the Python modules
- required to run yum. The error leading to this problem was:
- No module named yum
- Please install a package which provides this module, or
- verify that the module is installed correctly.
- It's possible that the above module doesn't match the
- current version of Python, which is:
- 2.7.6 (default, Apr 30 2014, 13:52:14)
- [GCC 4.1.2 20080704 (Red Hat 4.1.2-54)]
- If you cannot solve this problem yourself, please go to
- the yum faq at:
- http://wiki.linux.duke.edu/YumFaq
本文引用自http://novell.me
我了个去。于是谷歌,开始方向偏了。变得去重装yum了。 http://novell.me
最后面回到这个报错上,仔细看了下,发现原来其实yum这玩意貌似也就是一个python写的一个模块,它依赖于python,而且有做版本验证。它应该是依赖于旧版的python的,而我当前的环境用的python是2.7.6.
本文引用自Novell迷网站
突然想起来前些时间安装了python2.7.6 ,并且修改了环境目录下的python指向到新的版本。
CopyRight http://novell.me
于是回到/usr/bin目录将它改回来。
Novell迷网站原创内容,未经允许,谢绝转载!
- cd /usr/bin
- novell-1.desktop$ ll python
- lrwxrwxrwx 1 root root 34 Apr 30 14:03 python -> /usr/local/python-2.7.6/bin/python
- novell-1.desktop$ ll python*
- lrwxrwxrwx 1 root root 34 Apr 30 14:03 python -> /usr/local/python-2.7.6/bin/python
- lrwxrwxrwx 1 root root 6 Jun 18 2013 python2 -> python
- -rwxr-xr-x 1 root root 8304 Jul 14 2012 python2.4
- novell-1.desktop$ sudo mv python python27
- novell-1.desktop$ sudo mv python2.4 python
Novell迷,迷Novell
再运行yum 进行安装MySQL-python进行安装即可。
内容来自http://novell.me
转载请注明出处!本文地址 http://novell.me/Linux/201405/redhat-yum-issue.html
(责任编辑:Novell迷)