MySQLdb error when starting python server on MacOSX10.6

Starting my server (python manage.py runningerver) gave this error:

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: no module named MySQLdb

I tried to win the solution on this page to no avail: Django + MySQL on Mac OS 10.6.2 Snow Leopard

And then switched to Thierry Lam (5 votes) on Django - MySQLdb: Character not found: _mysql_affected_rows

Following Thierry Lam's suggestions, my error is now read:

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen (/Users/steven/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.3-fat.egg-tmp/_mysql. therefore, 2): library not loaded: libmysqlclient.18.dylib

This is similar to the same communication problem. Any wisdom to share? Thanks in advance.

+5
source share
2 answers

It looks like everything is installed correctly for you, but it cannot find libmysqlclient. Have you tried the following?

> sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
> sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
+15
source

It looks like you are just missing the mysql-python dependency for mysql and Django. I don’t know how you installed Django. Use pip or easy_install to install it.

pip install mysql-python

PostgreSQL is recommended for Django, but for development purposes, creating a sqlite database is much easier.

+1
source

All Articles