我使用的是CentOS版本6.5 (最终版)。
我目前使用的是Python2.4,在其中我可以毫无问题地使用MySQL。
root@dedicado [/home/digicelc/public_html/gestion/python/cater]# python
>>> import MySQLdb
>>> 但是,当我在python2.7中尝试它时
root@dedicado [/home/digicelc/public_html/gestion/python/cater]# python2.7
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named MySQLdb
>>> 我不想更改服务器中的python版本,只想让模块在2.7版本中可用
最后是:
# yum install python27-MySQL-python 给了我这个:
Error: Package: python27-MySQL-python-1.2.3-9.el6.centos.alt.x86_64 (scl)
Requires: libmysqlclient_r.so.16()(64bit)
Error: Package: python27-MySQL-python-1.2.3-9.el6.centos.alt.x86_64 (scl)
Requires: libmysqlclient_r.so.16(libmysqlclient_16)(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest发布于 2015-04-08 00:18:39
我也遇到过类似的问题。我必须安装python2.7来获取特定的库,然后无法通过python2.7运行mysql,因为它是安装在2.6上的。
试试这个: pip2.7安装MySQL-python
https://stackoverflow.com/questions/23546452
复制相似问题