The following error was reported today when Django created the MySQL database table:
Raise improperlyconfigured("Error loading MySQLdb module:%s" %e)Django.Core.Exceptions.improperlyconfigured: error loading < Span style= "font-family: ' Microsoft Yahei ';" >mysqldb module : no module named mysqldb
in my Baidu query, finally found the problem is that there is no installation of Mysql-python. Based on this problem, various solutions are available on the web, most of which are based on Python packages
Install and manage the tools pip command to install Mysql-python(perform pip install Mysql-python installation under cmd command line), However, the following errors were reported during the installation process:
Command "D:\python27\python.exe-u-C" Import setuptools, tokenize;__file__= ' c:\\users\\tangbo\\appdata\\local\\temp \\pip-build-wif0di\\mysql-python\\setup.py '; Exec (Compile (getattr (tokenize, ' open ', open) (__file__). Read (). Replace (' \ r \ n ', ' \ n '), __file__, ' exec ') "Install--record c:\users\tangbo\appdata\local\temp\pip-yvc9jx-record\ Install-record.txt--single-version-externally-managed--compile "failed with error code 1 in c:\users\tangbo\appdata\ local\temp\pip-build-wif0di\mysql-python\
I found a simpler way to solve this problem:
1, download mysql-python installation package, the address is as follows:
https://pypi.python.org/pypi/MySQL-python/1.2.5
Open the Web page, navigate to the location as shown, download the arrow refers to the installation package (my machine is 64-bit, download this 32-bit also no problem):
2. Click Install Package Installation
Click to set the path as follows:
Where Python Directory: Set the path to Python installation
Installation directory: Set to the Python installation path under the \lib\site-pack-ages\ directory
Complete the above steps andMysql-python installation is completed .
The program that Django creates MySQL database tables runs smoothly. The results of proper operation under Eclipse are as follows:
Django.core.exceptions.ImproperlyConfigured:Error loading mysqldb module:no module named MySQLdb workaround