Installing Python, Eclipse, and PyDev

Topics

Note:

This document refers to Eclipse 4.7 (Oxygen) for Windows, the most current version as of this writing. Note that different computer set ups and themes may mean that the appearance of the screen shots in this document may not match exactly your computer system. In particular, the Mac version of Eclipse looks significantly different, although it has the same functionality as the Windows version.


PyDev (Python Development Environment) is a plugin that enables users to use Eclipse for Python development -- making Eclipse a first class Python IDE (Integrated Development Environment) -- It comes with many goodies such as code completion, syntax highlighting, syntax analysis, refactoring, debug and many others From http://pydev.org/

Pydev requires that you first install a Python interpreter and the Eclipse integrated development environment. Pydev is a plugin for Eclipse and cannot be used without having both Python and Eclipse installed.


Installing Python

Download the latest version of the Python interpreter from http://www.python.org/download/. Choose the version appropriate to your computer. For Windows users you may choose Windows x86 (32 bit) or Windows x86-64 (64 bit). If you are unsure whether your particular PC supports 64 bit programs or not, choose standard Windows x86. Note where on your system you installed Python as you must know this when configuring Pydev. For the Mac choose the 64 bit version at all times.

As of this writing the latest version of Python available is 3.4.1.


Installing Eclipse

See Installing Eclipse.


Installing Pydev

Install Pydev by following the instructions in the Installing Plug-ins section of Installing Eclipse. The installation URL to enter into Eclipse's Install dialog box for Pydev is:

http://pydev.org/updates

As of this writing the latest version of Pydev available is 3.7.1


Configuring Pydev

Pydev must be configured in order to work properly with your Eclipse and Python set ups. From the Eclipse main menu choose Window / Preferences. (For the Mac choose Eclipse / Preferences). This brings up the Preferences dialog box. Choose Pydev / Interpreter - Python:

Preferences - Python Interpreter

The Quick Auto-Config may set Eclipse up the way you want it, but only if some version of Python 3 is selected. If no version of Python is found, follow the next steps. If an earlier version of Python is found, make sure that you remove it with the Remove button and follow the next steps.

Press the New button, and from the Select Interpreter name the interpreter (ex: Python) and browse to the location of your python.exe file and select it. (The Python interpreter should be located wherever you installed Python on your system.) The following is an example of what the selected name and interpreter may look like:

Interpreter Selected

Naming and selecting the Python interpreter brings up the Selection Needed dialog box:

Selection Needed

Accept the default selections and press OK. The Preferences dialog box now shows the Python interpreter and libraries that you selected. Press OK to accept these values. Eclipse will take a moment to process these selections. You may now start programming in Python.

For Mac Users

Windows places all Python files in one place. Mac OS 10 splits the Python installation into two areas. The installation under System seems to be just user interface files. The actual Python executable that you must enter in the Select interpreter dialog box is at one of:

/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.3
/System/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.3

This varies depending on the version of Mac OS you are running.


Adding Libraries

The Python interpreter ships with a number of libraries, such as the math library, already installed. Other Python applications and programs may require further external libraries and you may add these libraries to your Pydev set up.

To add a library to the Pydev installation, open the Preferences dialog box. (You used this item in the previous section to set up the Python interpreter.) This time you must add folders to the System PYTHONPATH. To do so press the New Folder button, and then browse to the folder containing the libraries you wish to add. After selecting the folder containing the new Python library press OK to confirm the selection.


Resources

http://www.eclipse.org/
The Eclipse home page.
http://pydev.org/
The Pydev home page.
http://www.python.org/
The Python home page.
http://www.python.org/dev/peps/pep-0008/
A style guide for Python code.
http://wiki.python.org/moin/
The Python wiki.