1. In the MySQLdb directory edit the _mysql.c file and comment out the following line:
#define uint unsigned int
Run the following commands from the Python MySQL directory
sudo mkdir /usr/local/mysql/lib/mysql
sudo ln -s /usr/local/mysql/lib/libmysqlclient_15.dylib /usr/local/mysql/lib/mysql/libmysqlclient_15.dylib
sudo ln -s /usr/local/mysql/lib/libmysqlclient_r.dylib /usr/local/mysql/lib/mysql/libmysqlclient_r.dylib
sudo ln -s /usr/local/mysql/lib/libmysqlclient_15.dylib /usr/local/mysql/lib/mysql/libmysqlclient_15.dylib
sudo ln -s /usr/local/mysql/lib/libmysqlclient_r.dylib /usr/local/mysql/lib/mysql/libmysqlclient_r.dylib
sudo ln -s /usr/local/mysql/lib/libmysqlclient_r.dylib /usr/local/mysql/lib/mysql/libmysqlclient_r.15.dylib
python setup.py build
python setup.py install
You might see a few warnings during the build process but they appear to be safe to ignore.
I referenced the following site to help with the initial compile error with the unsigned int. I added an additional sym-link to resolve a build error when attempting to find a library.
4 comments:
You can just edit site.cfg to change:
mysql_config = /usr/local/mysql/bin/mysql_config
Or, add mysql bin to your path, which is probably preferable!
I still get this error when I try importing MySQLdb in python .. any ideas
Traceback (most recent call last):
File "stdin>", line 1, in module>
File "MySQLdb/__init__.py", line 19, in module>
import _mysql
File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 7, in module>
File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dynamic module does not define init function (init_mysql)
>>>
Thanks dude, that worked for me... except, you need to run the install with sudo.
mysql-5.0.67-osx10.4-universal.tar.gz avoids the wrong architecture issues
Post a Comment