Sistema de blogs Diarium
Universidad de Salamanca
Pablo Gallardo's Blog
My professional web log about IT, Project Management & SAP
 

How to create a Python project in Eclipse

This post explained how to create a Python project in Eclipse, using plugin PyDev.

It assumes you have followed previously the installation and configuration instructions on this previous post.

Step-by-step procedure to create a Python project in Eclipse

1. Run Eclipse

Open Eclipse on you operating system.

2. Switch to Python perspective

As Eclipse does not have Python integrated as default, the perspective will be other than it. For example, if you followed the installation instructions on this post, default perspective will be Java.

To change perspective to Python, locate the “Add perspective” button on the top right corner. The “Add perspective” icon may be located between the magnifying glass and Java perspective icons.

In the “Open perspective” dialog, select the “PyDev” perspective and click “Open” button.

Open Perspective Dialog

Python perspective button, recognizable because of the Python icon, will be added to the list. You can switch from this perspective to another (Java, for instance) when you consider.

 

3. Create Python project

Once you are in the main screen of Eclipse, go to menu bar > “File” > “New” > “PyDev Project”.

Create Python project in Eclipse

Because we enabled the PyDev perspective, PyDev project is proposed by default.

Enter “HelloWorldPython” in “Project name” textbox.

New Python Project dialog in Eclipse

Click on “Finish”

You will find the new project structure in PyDev Package Explorer on the left of Eclipse main screen.

 

4. Create module

On Eclipse main screen, go to menu bar > File > New > PyDev Module.

Enter “HelloWorld” in textbox “Name”.

You may find two pop-ups:

  • Default Eclipse preferences for PyDev dialog. I just accepted the three of them.
  • Template dialog. You can select “<Empty>” and click “OK”.

 

5. Write program

Overwrite code in “HelloWorld.py” with this code:

print("Hello world!")

When finished, go to menu bar > File > Save.

 

6. Run program

While in Eclipse main screen, locate the “Run as…” icon on the tool bar. Click it.

The “Run as” dialog will be opened. There are two options: “Python run” and “Python unit-test”. Choose the former and click “OK”.

Console will be opened at the bottom of the screen. It will display the text “Hello world!”.

Congratulations! You have created and run your first Python project in Eclipse.

 

You might be also interested in…

External references

pmgallardo

About pmgallardo

I studied Computer Science at University of Salamanca. Since then, I have been working first as developer and then as SAP consutant. This blog is about problems I dealt when using computers, and more important, the solutions I found. Whenever I am on an issue and suddenlly I have a flash that leads me to a solution, I document my discoveries in a post.

, , , , , , , , , , , , , , , ,

No comments yet.

Leave a Reply


*

Política de privacidad
Studii Salmantini. Campus de excelencia internacional