开发者

Modifying DYLD_LIBRARY_PATH for mysql, python, and django

开发者 https://www.devze.com 2023-02-12 09:53 出处:网络
I\'ve seen two dozen posts concerning this issue, but I\'m so NOOB I\'m not sure how to modify everything correctly.

I've seen two dozen posts concerning this issue, but I'm so NOOB I'm not sure how to modify everything correctly.

I'm attempting to finish the installation, but when I go to Python and "import MySQLdb" I end up getting:

ImportError: dlopen(/Users/pccampbell/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.5-fa开发者_如何学Pythont3.egg-tmp/_mysql.so, 2):


Library not loaded: libmysqlclient.16.dylib

Referenced from: /Users/pccampbell/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.5-fat3.egg-tmp/_mysql.so

I then run this command which everyone says works (and it does, but only temporarily!):

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

SO, I'm trying to execute the following to permanently change the path (as found on another help site):

sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib lib/python2.7/site-packages/_mysql.so

BUT, I end up getting this error:

install_name_tool: can't open file: lib/python2.7/site-packages/_mysql.so (No such file or directory)

I found the _mysql.so file at, but even when I use this path it doesn't work:

/Users/pccampbell/MySQL-python-1.2.3/build/lib.macosx-10.5-fat3-2.7

THE BOTTOM LINE: is there a way to permanently modify the DYLD_LIBRARY_PATH, so I don't have to run the export command every time. If so, then could you please, please, please provide the specific syntax, because I've been guessing and checking for a long time. :(

ANy help GREATLY appreciated.

Patrick


According to Matt's idea, in mac os x Lion, you should add the following sentence like this to your /etc/profile:

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


add the export command to /etc/profile as follows:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib

Note:There is no "/" after lib above. If you add / after lib, and try installing MySQL-python, the errors will keep occuring when running ">>import MySQLdb"

I hope this solves the problem for you! :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号