开发者

Pydev: Where do I have to add the path for an external lib (usr/local/mysql/lib/libmysqlclient)?

开发者 https://www.devze.com 2023-03-14 04:15 出处:网络
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/mysq

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


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.


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

0

精彩评论

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