Paul Draper
Paul Draper

Reputation: 83441

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.

Upvotes: 0

Views: 175

Answers (1)

El Ninja Trepador
El Ninja Trepador

Reputation: 1114

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 ;)

Upvotes: 1

Related Questions