Search code examples
mysqldjangopymysql

ImportError: No module named 'MySQLdb' - django + mysql


This question concerns: django 1.5.1 with python 3.3 and mysql 5.6.12

Wanting to get Mysql running with Django. Had everything configured, even Database exists with user-pemissions. Got some error when trying syncdb:

ImportError: No module named 'MySQLdb'

There is obviously the Mysql-Lib for python missing. Downloaded the master-edition from petehunt/PyMySQL. Tried "python setup.py install" . Says:

ImportError: No module named 'constants'

Downloaded another version. A tarball from here. Run "python setup.py install". Seems to work, tried to run the syncdb command "python manage.py syncdb". Still:

ImportError: No module named 'MySQLdb'

Any suggestions what to do now? Thanks in advance.


Solution

  • mysqlclient is the recommended mysql driver for python 3

    You can install it via pip:

    pip install mysqlclient