Pydev:我必须在哪里添加外部库的路径(usr/local/mysql/lib/libmysqlclient)?

发布于 2024-11-16 00:14:46 字数 611 浏览 7 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

相权↑美人 2024-11-23 00:14:46

在项目的属性中(可通过 Project > Properties... 访问),单击 PyDev - PYTHONPATH 项。您的 PYTHONPATH 视图应该是可见的。单击外部库选项卡并添加您的库。下次运行时,它应该正确导入。

In your project's properties, (accessible from Project > Properties...), click the PyDev - PYTHONPATH item. A view of your PYTHONPATH should be visible. Click the External Libraries tab and add your library. The next time you run, it should import correctly.

南烟 2024-11-23 00:14:46

您可以将这些库添加到设置中以获得您想要的效果。这可以在通过“窗口”>“访问的库”设置中完成。首选项> 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文