I'm needing to connect to a MySQL database that is on my local machine via a Python script. Here's my setup:
- Installed (and have been using for developing web apps for several months) MySQL 5.6.22 (downloaded .dmg from here)
- Running the pre-installed python (2.7) that came with Yosemite
- Downloaded:
MySQL-python-1.2.4b4.tar.gz
and installed via terminal by runningpython setup.py install
in the unzipped folder
This is the output I got at the end of the installation:
Installed /Library/Python/2.7/site-packages/distribute-0.6.28-py2.7.egg
Processing dependencies for distribute==0.6.28`
Finished processing dependencies for distribute==0.6.28
Processing MySQL_python-1.2.4b4-py2.7-macosx-10.10-intel.egg
creating /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.10-intel.egg
Extracting MySQL_python-1.2.4b4-py2.7-macosx-10.10-intel.egg to /Library/Python/2.7/site-packages
Adding MySQL-python 1.2.4b4 to easy-install.pth file
Installed /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.10-intel.egg
Processing dependencies for MySQL-python==1.2.4b4
Finished processing dependencies for MySQL-python==1.2.4b4
But when trying to connect, my py script gives me this error:
ImportError: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.10-intel.egg/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.10-intel.egg/_mysql.so
Reason: image not found
('result', 256)
When I do
$ python
>>> import MySQLdb
I get the same error.
Any ideas on how I might get this sorted out?