I have been searching for a good way to use python virtual environments from within eclipse.
The only suggestion I have found is to create a new eclipse-wide "interpreter" for each virtual environment. That is cumbersome for many project, but it works.
I want to have a virtual environment per project, so the path to the interpreter will have to change for each project.
1) can you define an interpreter specific for a project?
2) alternatively, how do you define an interpreter that use e.g. PROJECT_LOC variable?
any suggestions are welcome
Unfortunately, the way that PyDev works, it expects all interpreters to be configured "eclipse-wide" (and then in a given project you can say which one should be used for that particular project if it shouldn't be the default one).
The other option is actually having one Eclipse workspace per project (then you'd configure a single "eclipse-wide" interpreter for it).
Another option, if the interpreters are from the same Python version and you're only changing the installed libraries would be creating a single "eclipse-wide" interpreter as the default one for all projects and then configuring the additional paths to be included in the PYTHONPATH per project.
Personally what I usually do is having one Eclipse workspace per project and having everything independent as I'm usually working on a single project at a time (so, I can focus only on what it's important for it), so, switching projects would be opening a new Eclipse instance pointing to the proper place, although it depends quite a lot on your use case (which you haven't actually made explicit) -- each project would have its own virtual env configured "eclipse-wide" (although in my case it's actually conda virtual envs).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With