Download and install Eclipse Even though you will be developing Python you will still need Eclipse with the Java SDK. I think this is for 2 reasons. Firstly Python support for Eclipse is in the form of an Eclipse plug-in as opposed to a fully integrated Eclipse application and there aren’t any Eclipse distributions with no (computer) language support. The other reason (I think) is that many of the development tools for Java are used for Python.
- Go to the Eclipse download page: http://download.eclipse.org/eclipse/downloads/
- From the Latest Release section download the latest version 3.6.1 (eclipse-SDK-3.6-win32.zip)
- Create a folder for your python development installation. You will save yourself a lot of trouble if you install the application under a directory without a space in the directory path name:
- Unzip the downloaded zip in this folder, so you have a folder called
- Go to the Python download site: http://www.python.org/download/releases/2.7/
- Download the Windows MSI installer
- Install it in the default location:
- Launch Eclipse by double clicking on the eclipse executable located at:
- When it launches for the first time, it will ask you to provide the location of the workspace, so pick a location without spaces in the path and not under the eclipse root (
c:\python\eclipse). I’m going to keep everything together and set my workspace to
- From the Eclipse menu bar Help -> Install New Software…
- Click the Add button and enter the details of the PyDev repository.
- Set Name to Pydev and Pydev Extensions
- Set Location to http://pydev.org/updates
- Then click OK
- After a few seconds PyDev and PyDev Mylyn Integration (optional) will appear. Click the Select All button and then click Next.
- Eclipse will work out the dependencies (which in this case is none) and allow you to click Next again.
- Accept the licence agreements, click Finish and go and get yourself a coffee.
- There were a couple of warnings about unsigned content, so just click through these.
- Go to: Window -> Preferences -> Pydev -> Interpreter - Python
- Click New…
- Enter Python 2.7 in the Interpreter Name and use the browse button and navigate to the
python.exeexecutable to fill in the Interpreter Executable field.
- When you’re done click Ok.
- Clicking Ok will make the Pydev perform a search for python bits.
- From the Eclipse menubar File -> New -> Project….
- Select PyDev -> Pydev Project, and click Next.
- Enter a Project name of HelloWorld.
- Then click Finish.
- You’ll be asked about switching to the Pydev perspective, so click Yes because this will make it easier to develop under.
- Highlight the HelloWorld project and from the Eclipse menu bar select File -> New -> PyDev Package.
- Set the Source Folder to /HelloWorld/src.
- Set the Name to uk.co.bigsoft.python.
- The click Finish
- Highlight the
Pythonpackage and select File -> New -> Pydev module.
- For the Name field enter helloworld.
- For the Template highlight Module: Main.
- Then click Finish
Note: Python cares about indentation so make sure your cut and paste produces the same indentation as above. Now that we have a program we are going to set up the debugger.
''' Created on 6 Sep 2010 @author: MrN ''' if __name__ == '__main__': c = 0 a = 5 b = 2 c = a + b print c
- Hover in the margin next to line
b = 2, right click and select Add Breakpoint. This will put a green spot in the margin.
- From the menu bar select Run -> Debug.
- If the Debug As window pops up asking you to Select a way to debug ‘helloworld.py’, then select Python Run, and then click Ok.
- This will ask us if we want to open a Debug perspective, so click Yes and Remember my decision otherwise it will keep pestering you.
No feedback yet
Form is loading...