Django项目中执行python manage.py syncdb时,报错如下:
File"C:\Python27\lib\site-packages\django\db\backends\mysql\base.py",line 27, in <module>
raise ImproperlyConfigured("Errorloading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured:Error loading MySQLdb module: No module named MySQLdb
解决方法:
步骤:
1. 安装Microsoft Visual C++ Compiler for Python 2.7
下载地址:https://www.microsoft.com/en-us/download/details.aspx?id=44266
2. 安装MySQL-python 1.2.3 for Windows and Python 2.7
下载地址:http://www.codegood.com/archives/129
3. pip install MySQL-python --timeout=20--trusted-host pypi.python.org
4. 在pycharm里 File -> Settings -> Python interpreter 里面添加MySQL-python