Pydev:我必须在哪里添加外部库的路径(usr/local/mysql/lib/libmysqlclient)?
我使用 mysqldb 和 pydev eclipse。我成功编译了 mysqldb 1.23,现在我想导入它。 mysqldb 1.23 需要库 libmysqlclient.18.dylib 在我的情况下位于 /usr/local/mysql/lib 中。因此,当我在 eclipse 中启动测试程序时,它会崩溃,因为它找不到正确的库。因此我需要告诉 Eclipse 在哪里可以找到库。
我该怎么做?
在 eclipse/pydev 中,我必须告诉它 libmysqlclient.18.dylib 位于上述目录中的什么位置?
我收到的错误消息
ImportError: dlopen(/path/to/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /path/to/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so
Reason: image not found
I use mysqldb and pydev eclipse. I successfully compiled mysqldb 1.23 and now I would like to import it. mysqldb 1.23 needs the library libmysqlclient.18.dylib which lies in my case in /usr/local/mysql/lib. So when I start my test program in eclipse it crashes since it does not find the correct library. Therefore I need to tell eclipse where to find the libs.
How do I do this my case?
What and where in eclipse/pydev do I have to tell it that libmysqlclient.18.dylib resides in the above directoy?
The error message I get
ImportError: dlopen(/path/to/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /path/to/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so
Reason: image not found
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在项目的属性中(可通过
Project > Properties...
访问),单击PyDev - PYTHONPATH
项。您的 PYTHONPATH 视图应该是可见的。单击外部库
选项卡并添加您的库。下次运行时,它应该正确导入。In your project's properties, (accessible from
Project > Properties...
), click thePyDev - PYTHONPATH
item. A view of your PYTHONPATH should be visible. Click theExternal Libraries
tab and add your library. The next time you run, it should import correctly.您可以将这些库添加到设置中以获得您想要的效果。这可以在通过“窗口”>“访问的库”设置中完成。首选项> PyDev >解释器 - Python >图书馆。添加要添加的库的 .egg 或源文件夹,然后单击“应用”,然后单击“确定”。
这个答案由 How to add python “libraries” to Eclypse 提供和 pydev
You can add these libraries to the settings to get the effect you want. This can be done in the Libraries setting accessed through Window > Preferences > PyDev > Interpreter - Python > Libraries. Add the .egg or source folder of the libraries you want to add and click Apply followed by OK.
This ansqwer was provided by How to add python "libraries" to Eclypse and pydev