Reputation: 3726
I've spent what feels like forever running down MySQL blogs and SO questions trying to figure out how to install a MySQL server and MySQLdb for Python on my Mac OS 10.6.7. I think I got the MySQL server installed through MacPorts(which took an eternity), but I can't import MySQLdb (downloaded from here) with Python.
Here's the error I get:
import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/EPD64.framework/Versions/6.3/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.5-x86_64.egg/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Frameworks/EPD64.framework/Versions/6.3/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.5-x86_64.egg/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Frameworks/EPD64.framework/Versions/6.3/lib/python2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.5-x86_64.egg/_mysql.so
Reason: image not found
I followed the instructions on this question for cleaning up and reinstalling my MySQLdb installation. Everything worked fine going through the steps, but it resulted in the same error.
I'm also not sure why it's calling the EPD64.framework directory -- the module folder and contents are actually contained in /Library/Frameworks/Python.Framework/.../site-packages. Could MacPorts have crossed the wires somewhere?
(I did one extra step of modifying the msyql_config path in site.cfg to /user/local/mysql/bin/mysql_config)
I also tried to follow the advice of this question but can't find the /User/$User/.python-eggs directory at all, so not sure what to do about that.
Any ideas?
Upvotes: 2
Views: 3077
Reputation: 1531
The second link in your question kind of contains the answer, but there is so much extra information mucked in that's unnecessary...
Simply make sure you have the following bin: /usr/local/mysql/bin/mysql_config
And then when installing MySQLdb all you need to do is change mysql_config.path
in setup_posix.py
to:
mysql_config.path = "/usr/local/mysql/bin/mysql_config"
Try simply doing that, don't do the symlinks they suggest or clean the eggs etc.
Upvotes: 1