When you install PyDev on Eclipse Luna, the default interpreter for python is selected as Python2 on Ubunut 14.04 machine because Python2 is the default package in Ubuntu. Lots of new features have been added to Python 3 which are not supported in Python2. So, you need to install Python 3 on Ubuntu machine if you want to use it. Also, when you type ‘Python’ on Ubuntu terminal, it selects Python 2. To select Python 3 as interpreter, you need to type ‘Python3’ on the terminal. Assuming you already installed Python 3 on your Ubunu machine (command sudo apt-get install python3 can be used to install Python3) , do the followings to add Python3 to Pydev Eclipse.
- In Eclipse Luna, open Window -> Preferences
- Select PyDev -> Python Interpreter and then Click on New button to add Python3
- When you Click on New, a small pop-up screen will appear where you need to provide the name and location of Python3 Interpreter. Keep Name = Python3 and to find the location, type which python3 on your terminal. [I am getting error because I already added Python3 to PyDev on my system]. That’s it. You are done now.
- Now when you create a PyDev Project, select Python3 as the interpreter. If Python 3 is not in the list, click on link ‘click here to configure an interpreter not listed’. You might have to delete Python 2 if Python3 is not selected as default interpreter.