2014年2月22日 星期六

Python - How to install MySQL-python on MAC ?

1. Open console on mac.

2. Input cmd ...

$> pip install MySQL-python

$> sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /Library/Python/2.7/site-packages/_mysql.so

$> sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /Directories/To/File/filereferencedinpython

3. Add setting ..

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

Reference :

1. http://moravec.net/2013/04/installing-mysql-python-on-mac-os-x/
2. http://coddswallop.wordpress.com/2012/08/23/solving-library-not-loaded-libmysqlclient-18-dylib-when-importing-mysqldb-on-lion/

沒有留言: