So, I'm slowly working in some Python 3.0, but I still have a lot of things that rely on 2.5.
But, in Eclipse, every time I change projects between a 3.0 and a 2.5, I need to go through
Project -> Properties -> project type.
Issue 1: if I just switch the interpreter in the drop down box, that doesn't seem to change anything. I need to click "click here to configure an interpreter not listed", and UP the interpreter I wish to use.
Issue 2: That would be fine if I was switching to 3.0 for every project for the rest of my life, but I still am doing a lot of switching between projects and I don't see that changing anytime soon. So, I'm just trying to save a few operations.
Is there a way to configure Eclipse so that it remembers which interpreter I want associated with which project?
What if I created an entirely new workspace? Is "interpreter" a property of a workspace?
Also, it doesn't seem to matter what I choose when I create a new project via File -> New -> Pydev Project. Whatever I last selected through "Properties" is what eclipse is using.
This is Eclipse 3.4.0, running in Windows XP.
But Classic Eclipse should be enought. Eclipse Classic is no longer supported as of 2014. The last release was Eclipse Classic 4.2.
Create a new projectGo to File → New → PyDev Project to start a wizard. In the next window that appears, enter the name of your project and select "python" and 3.0"; as the type. Make sure "create default 'src' folder and add it to the pythonpath?" is selected. Click Finish.
Most of the Eclipse community uses the IDE to develop Java code (so you might be familiar with Eclipse even if you've never used Python). Because of this community bias, setting up Eclipse to edit Python code is slightly complicated. Eclipse requires the PyDev extension to properly develop Python code.
You can set the interpreter version on a per-script basis through the Run Configurations menu.
To do this go to Run -> Run Configurations, and then make a new entry under Python Run. Fill in your project name and the main script, and then go to the Interpeter tab and you can pick which interpreter you want to use for that script.
I've used this to have Python 2.2, 2.5, and 3.0 projects in the same workspace.
OK --
It definitely seems like "interpreter" is a property of your "workspace". I hadn't really considered that too much because I always thought of the workspace as "a folder in which I keep whatever" instead of a consistent unified environment for one kind of development.
Also, you can't switch between workspaces in one instance of Eclipse (it shuts down and restarts), but you can run two instances of Eclipse at once, one for each workspace.
Now, I guess I like the fact that Eclipse handles it that way. It has a more "modular" feel, and what originally bothered me I now think it sensible. I don't need to worry about having two interpreters to choose from, or choosing the default or moving one up. I just need to worry about which workspace I'm in.
Hope this helps someone. . .
EDIT: as noted by Kiv, "interpreter" is not a property of your "workspace" (as I stated above). Instead, for any project, there is a "run configuration" (incidentally, there is also a debug configuration). The run config allows the user to set the executable, and the path, and a number of other options.
*I'm sure these things are known to long-time users, but I never had to deal with this until I changed python versions.**
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