[Answer]-MySQLdb import error on windows 7 + Django

1👍

If you fire up regular python and try

>>> import MySQLdb

and then fire up the django shell

> python manage.py shell
>>> import MySQLdb

and get the same error, I would presume that you have the wrong SQL package for your system – this is often a 32bit vs 64bit issue.

Dig out the actual SQL dll (called _mysql.pyd and see if you can import that directly into pyton (go to the directory containing the dll, fire up python and import _mysql). This should help speed up the diagnosis.

Alternatively, I’ve always found Bitnami’s django stack to be the least painful way to install and manage my Windows django stack. It will set up and manage Apache HTTP Server, MySQL, Python, SQLite, PostgreSQL, Django all in one go.

Leave a comment