简体   繁体   中英

How to use a package from another project in PyDev

I have read this , but it didn't work for me.

These are the steps I used:

  1. Right-click project1 > Properties > Project References > select project2R
  2. Right-click project1 > Properties > PyDev - PYTHONPATH > Add source folder, but project2 is not listed

If I add project2 manually to .pydevproject , it replaces project2\\src with project1\\src .

This is really driving me crazy.

Just add the path to the folder containing any package you wish to use into your PYTHONPATH environment variable (create a new one if there isn't one already) and voilá!

For instance, suppose you have a package named "foo" in a directory "/path/to/project/src/foo". Simply append "/path/to/project/src" (note that I left "foo" out of the path because that's our package) to PYTHONPATH and then open an interpreter and try "import foo". This should work both on Windows and Linux too ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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