My Setup:
- Mac OS 10.6.6 - x86_64
- MySQL 5.5.8
- Python 2.7.1
- Django 1.2.5
- mysql-python installed via easy_install
My situation:
I've been struggling to get my setup to work. The problem is with the mysql-python interface. Originally, I was getting a similar problem (to the one I'm having with Django) doing an import statement in python:
import MySQLdb
But I read this question/solution that proved successful in fixing it. I installed django and it works great but it is having problems with the mysql interface. When I fire the Terminal and type:
>> python manage.py dbshell
the following error is generated:
Traceback (most recent call last): File "manage.py", line 11, in execute_manager(settings) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/init.py", line 438, in execute_manager utility.execute() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/init.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/init.py", line 261, in fetch_command klass = load_command_class(app_name, subcommand) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/init.py", line 67, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module import(name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/commands/dbshell.py", line 4, in from django.db import connections, DEFAULT_DB_ALIAS File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/init.py", line 77, in connection = connections[DEFAULT_DB_ALIAS] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/utils.py", line 92, in getitem backend = load_backend(db['ENGINE']) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/utils.py", line 33, in load_backend return import_module('.base', backend_name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module import(name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 14, in raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/adogc45/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.16.dylib Referenced from: /Users/adogc45/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so Reason: image not found
Now, I don't understand why importing the module in Python doesn't raise an error, but using the mysql interface in django does.
BTW, my settings.py looks like this:
DATABASES = {
'default': {
'ENGINE': 'mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
Also, the image actually exits in .../MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp
So, I have NO idea about what's going on.