简体   繁体   English

优胜美地:Python MySQLlib问题-'找不到合适的图像'

[英]Yosemite: Python MySQLlib issue - 'no suitable image found'

Trying to figure out why MySQLlib is not working on my installation. 试图弄清楚为什么MySQLlib无法在我的安装上运行。 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? 有人有什么想法吗?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM