Yosemite: Python MySQLlib issue - 'no suitable image found'

浪子不回头ぞ 提交于 2019-12-11 20:18:41

问题


Trying to figure out why MySQLlib is not working on my installation. Here's the error from a script which tries to import it:

Traceback (most recent call last):
File "test.py", line 4, in <module>
import MySQLdb as mdb
File  "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/_mysql.so
Reason: no suitable image found.  Did find:
/Applications/mampstack-5.4.36-0/mysql/lib/libmysqlclient.18.dylib/libmysqlclient.18.dylib: stat() failed with errno=20

Before this, I had the 'image not found' error which has been commonly reported - and trying some of the different solutions there led me to this issue. Weirdly, it seems that most people who have this issue have a 'wrong architecture' error.

Does anyone have any ideas?


回答1:


Solved it. I needed to specify the actual path, not the filename - I tried:

export DYLD_LIBRARY_PATH=/Applications/mampstack-5.4.36-0/mysql/lib/ 

Rather than:

export DYLD_LIBRARY_PATH=/Applications/mampstack-5.4.36-0/mysql/lib/libmysqlclient.18.dylib


来源:https://stackoverflow.com/questions/28196775/yosemite-python-mysqllib-issue-no-suitable-image-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!