Python beginner Tutorial using Eclipse PyDev Plugin

Pyton is a interpreted high-level programming language developed by Guido van Rossum. Python is free to use, even for commercial products, because of its OSI-approved open source license. Python runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java and .NET virtual machines.

The language is very easy to learn because its source code resembles pseudo code. Python is an object-oriented programming language. In Python, everything is an object, and can be handled as such. However, unlike Java, Python does not impose object-oriented programming as the main programming paradigm. It is perfectly viable for a Python project to not be object-oriented, i.e. to use no or very few class definitions, class inheritance, or any other mechanisms that are specific to object-oriented programming. In Python there is no curly braces to indentify a block of code. For example in case of an if statement all the code that is indented after the if statement belong to the if statement block.

This tutorial will go thru how to Install Python and the PyDev plugins for Eclipse. After that we will create a small "Hello world" program to demonstrate its usage.

Step 1: Download Python

You can download Python from For Windows you can use the native installer python-3.2.msi for Python and follow the instructions.

Windows Python Installation
Windows Python Installation
Windows Python Installation
Windows Python Installation

Step 2: Download Eclipse

Skip this step if you already have eclipse installed on your computer. Eclipse is based on Java so for you to install eclipse you need Java runtine. Most computers come pre-installed with Java and you can check if java is installed by by typing in the command java -version, otherwise go to and download Java 1.6 or higher.

Windows Java Version Check
Now you can go to the eclipse website and down the Eclipse installation which is a zip file.

Eclipse download for windows
Just unpack the downloaded zip file and Eclipse is ready, no additional installation procedure is required. To start Eclipse double-click on the file eclipse.exe in the same directory where you unpacked Eclipse.

Eclipse python workspace

Step 3: Eclipse Python Plugin

PyDev is a Python IDE for Eclipse, which may be used in Python, Jython and IronPython development supporting code refactoring, graphical debugging, code analysis and many other features. You can install PyDev via the Eclipse update manager using the following update site -

Eclipse PyDev Installation Add Site
Select Checkbox for PyDev and follow thru on the installation.

Eclipse PyDev Installation

Step 4: Configure Eclipse

We have to tell eclipse about the Python location. Please open Window -> Preferences. Select Interpreter Python inside the PyDev option and click on New Configuration and add Python executable path.

Eclipse PyDev Configuration
Eclipse PyDev Configuration

Step 5: Python Hello World Program

Create a Python Project named PythonBeginner. File -> New -> Project -> PyDev Project.

Hello World using Eclipse and PyDev
Hello World using Eclipse and PyDev
Right click on the src folder and Select New -> PyDev Module.

Hello World using Eclipse and PyDev
Name your new module HelloWorld and click Finish. Now copy the following source into the HelloWorld Python Module and save it.
Created on Oct 2, 2012

@author: betterThanZero

def hello(myInput):
    return "Hello World: " + myInput

myInput = input("Please type your name: ") 

Now right click on your HelloWorld module and select Run As -> Python Run

Hello World using Eclipse and PyDev
In the console input your name and press ENTER. All Done...

Hello World using Eclipse and PyDev

No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.