Reputation: 1911
Ok so I have Pydev installed on 2 machines. For some reason I have 3.5.1 on a laptop and 2.7 on the desktop. Now a project I have on the 2.7 machine (desktop) throws syntax errors on the other machine (laptop), which I guess must be because they are running different versions of Python, since I can't see any other possible cause. As such, I installed 2.7 on the laptop, but before attempting to change the default interpreter to 2.7 (which I may or may not have done correctly: I just added the 2.7 path and moved it to the top of the list of (2) interpreters) I tried fiddling with the launch preferences in an effort to make it work. Now when I try running the project, I get this:
https://i.sstatic.net/IiFoi.jpg
I tried googling things like 'how to add new interpreter in PyDev' but didn't find anything which helped. Anyone know what on earth is going and how I might get the project which works fine on the desktop working on the laptop as well?
I've noticed in this question:
Setting default Python grammar version in Eclipse PyDev
that it basically asks what may be the same thing (although I'm not sure the result I get which I showed in the imgur link is actually to do with the Python version so this problem may not be the same as that in the other question I linked: it seems I may have 2 problems: 1 which is similar to that in the question I linked and a new 1 (shown in the imgur link, at the bottom, where it says 'Ran 0 tests in 0.000 s) possibly caused by fiddling with the launch preferences). My question is how to proceed on the laptop so that I can make the project work. Could I do this by removing Python 3.5.1? Is it not possible to have 2 different versions of Python on the same machine and to choose which you use for each given project? If it is possible, how do you do this? I actually tried removing 3.5.1 from the interpreters but the result is the same and when I checked the interpreters again, 3.5.1 was still there, so I would also like to know how to remove an interpreter. Everything about this seems so incredibly awkward. Genuinely have no idea why things should be make so awkard.
Edit: I think I've successfully changed the interpreter that's being used, thanks to Joe, but I still get the useless result when I run that I posted in the imgur link. It looks like it's running a 'Python unit-test' (whatever that is) and I want to restore it to what it used to do, which was just a standard run. Any ideas appreciated.
Edit 2: turns out it just runs as whatever you last ran it as, by default and no option to change this, it seems.
Upvotes: 0
Views: 2379
Reputation: 25332
As a note, it seems the files in your screenshot aren't .py files (i.e.: it's BarCodeTest
when it should be BarCodeTest.py
), so, you don't have syntax highlighting nor anything associated to the PyDev editor.
After you change the file to a .py
file, you should be able to just use F9
to run the current file. The getting started manual: http://www.pydev.org/manual_101_run.html has more information on ways to properly run a module.
Upvotes: 1
Reputation: 7121
Of course this is possible:
Eclipse - Windows - Preferences - PyDev - Interpreters - Python Interpreter - New...
Then you can seelct the interpreter per project:
Right-click project - Properties - PyDev-Interpreter/Grammar - Interpreter - Pick from list
Upvotes: 2