Installing Eclipse and configure Eclipse for Python (PyDev) + Screenshots

Posted: October 30, 2012 in Python, Windows
Tags: , ,

If you were wondering which is a good IDE for Python Development, there are a lot of them. My personal favorite is the Eclipse but I also use the default IDLE Python at times. This post is a guide on Installing and setting up Eclipse and PyDev in a Windows PC.

Pydev + Eclipse

Step 1: Install Python

You can find a guide on Installing Python in your system here.

Step 2: Install Eclipse

You can download the “Eclipse Classic” version (32-bit or 64-bit)  from http://www.eclipse.org/downloads/ (~ 184 Mb).

The downloaded file wil be a zip file. Simply extract it to any desired location,  For example, extract it to your C: drive. So, now your eclipse folder will be “C:\eclipse”.

To open up eclipse, go to your eclipse installation folder (It is “C:\eclipse” in mine) & open “eclipse.exe” .

eclipse folder

You would see the welcome splash screen and then , you would be prompted to “Select a workspace” . You can choose any location you want or just leave it to the default values.This will the location where your projects and source codes will be saved.

workspace launcher

Now, you will see the Eclipse Start Page. You click on the “x” marked in red to close it and go to to the Workplace.

eclipse home screen

Step 3: Install PyDev

In your Eclipse program, you need to check for updates. You can do so by clicking on the Help>Check For Updates from the toolbar.

After checking updates, install them if prompted. Then Click on Help>Install New Software.

Install new software

Now, you will be presented with  a screen as shown below. Click on “Add“.

Now , put  Name field as “PyDev” and “http://pydev.org/updates” as the Location and press “OK“.

add repo url

Now, wait for a few seconds while it processes it. Now, tick on PyDev as shown below and click “Next“.

tick pydev

Click “Next“.

Now, “Accept” the license agreement and click “Finish“. It would start downloading the necessary files and install PyDev. You will be prompted with a message box asking whether you Trust Certificates.,simply select them and press “OK“.

Installing pyDev
After the installation is complete,it will prompt you to restart Eclipse. So, you have now successfully installed PyDev in Eclipse.

Step 3: Configure Interpreter

Click on Window>Preferences

Preferences

Now click on “PyDev” to expand section and click on “Interpreter – Python“. Now, click on “Add“.

Now, add the Interpreter Name as “Python27” and “Interpreter Executable” as “C:\Python27\python.exe” . You can change the location if you installed python in another directory. Then press “OK“.

interpreter location

You will be prompted to make a selection of which folders to be added to the SYSTEM pythonpath. Simply, choose “Select All” and press “OK“.

Now, finally, you will have your preference windows similar to the one shown below:

Now, you have done configuring the Interpreter. Now, lets see how we can start coding python in Eclipse.

Step 4: Creating a sample Python project in Eclipse

To start a Python Project in Eclipse, Go to File>New>Project.

Creating New PyDev project in Eclipse

Now, select the Wizard as “PyDev Project” and click on “Next“.

Now, Put the Project Name as “Hello World” or anything you want. And select the option “Create ‘src’ folder and add it to PYTHONPATH“. And press on “Finish“. (You might be prompted if you want to open it with PyDev perspective, click Yes).

Creating Hellow World in Eclipse with pydev

Now, click on the small triangle indicated next to your “Project Name” to expand  it. Now, left click on “src” and select “PyDev Module“.

Now, choose any name (which is going to be the name of your python source file) and input it in the “Name” field and press “Finish”. Make sure that you DO NOT ADD the .py extension, you only need to add a name.

You may have to double click on the helloworld.py (or what you named it) to open the source code file.

Add the following line to the source code:

print “Hello World”

Save the file, by pressing CTRL+S or File>Save.

Python Source Editor

To run your python code, click on the button which looks like a small Green Play button, and Go to Run As>Python Run. 

running your python program

The output of your program will mostly be displayed in the lower portion of the Eclipse window as shown below.

Your python program output window

So, yeah you installed Eclipse, installed and configured PyDev and got a little familiar with writing python code and executing them in Eclipse. Thats all for today.

If you liked/disliked or have any sort of questions, please leave a comment. And yeah, you can always follow my blog to  get future updates.😀

ΞXΤЯ3МΞ

Comments
  1. ΞXΤЯ3МΞ says:

    Thnxs for the like @sethsnap

  2. ΞXΤЯ3МΞ says:

    Thanks fr the like! @thesweetkitten

  3. reporterwhb says:

    Wow, you’re a really good computer programmer! What other projects have you made?

  4. Pavneet says:

    Thanks for this great tutorial. even on something as basic as “hello world”, however, I seem to be getting an error. My consol has the following error: “Users\Pavneet\Python\python.exe: can’t open file ‘C:\Program Files (x86)\Eclipse\workspace\hello world\src\helloworld.py’: [Errno 2] No such file or directory”

    do you know what i’m doing wrong?

  5. Dnyanraj says:

    Very Nicely written .. Thank you.

  6. saipreethy says:

    it was really helpful thanks…🙂

  7. Aowen says:

    This was great! Thank you!

  8. pavan says:

    extremely useful for a beginner..Thanks a ton :):):)

  9. Manoj says:

    Great. Thanks for your step-by-step instructions.

  10. imran says:

    thank u very much

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s