简体   繁体   English

使用pip安装MySQL-python时出错

[英]error installing MySQL-python with pip

I am having following error when I try to run server 尝试运行服务器时出现以下错误

django.core.exceptions.ImproperlyConfigured: 
Error loading MySQLdb module: No module named 'MySQLdb'

I tried using pip install mysql-python , but it gave me this errror: 我尝试使用pip install mysql-python ,但这给了我这个错误:

Collecting mysql-python Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 20, in <module>
  File "/tmp/pip-build-t81ezx2d/mysql-python/setup.py", line 13, in <module>
    from setup_posix import get_config
  File "/tmp/pip-build-t81ezx2d/mysql-python/setup_posix.py", line 2, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'    
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-t81ezx2d/mysql-python

These are the modules I have installed through pip: 这些是我通过pip安装的模块:

alabaster==0.7.6
Babel==2.0
Django==1.8.3
docutils==0.12
Jinja2==2.8
MarkupSafe==0.23
mysql-connector-python==2.0.4
Pygments==2.0.2
pytz==2015.4
six==1.9.0
snowballstemmer==1.2.0
Sphinx==1.3.1
sphinx-rtd-theme==0.1.8

Any help? 有什么帮助吗?

Edit: solved the issue using mysqlclient , Mysql-python isn't available for Python 3. 编辑:使用mysqlclient解决了此问题,Mysql-python无法用于Python 3。

first install then it will work fine. 首先安装,然后它将正常工作。 apt-get install python-dev libmysqlclient-dev

Maybe a capitalization issue? 也许是大写问题?

try this: 尝试这个:

pip install MySQL-python

Hopefully that works, but if not, try using 希望能奏效,但如果不能,请尝试使用

pip search stringToSearchFor

to find the proper package name 找到正确的包装名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM