Marcus
Marcus

Reputation: 9472

Can't Run MySQL db on Django

I encounter an error when I run

python manage.py syncdb


...
  File "/Users/Marcus/Documents/Django/venv/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 17, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

My Setup:

$ pip list

Django (1.5.4)
pip (1.4.1)
setuptools (0.6c11)
stevedore (0.10)
virtualenv-clone (0.2.4)
virtualenvwrapper (4.1.1)
wsgiref (0.1.2)

When I do $ pip install mysql-python I get a "error: invalid command 'egg_info'

I'm currently running MAMP, but I haven't changed any of the settings . MySQL Server is green.

Any ideas how to fix this

Upvotes: 0

Views: 140

Answers (2)

netoxico
netoxico

Reputation: 11

If you're working on a mac, I highly recommend using a virtual machine with some linux distribution http://www.vagrantup.com/ to avoid having this kind of problem installing libraries in mac os

Upvotes: 1

Gidrek
Gidrek

Reputation: 750

If you are using Ubuntu try this:

sudo apt-get install build-essential python-dev libmysqlclient-dev

This solve the error for me.

Upvotes: 1

Related Questions