This tutorial provides all the steps required to install Eclipse for developing applications in Python on Windows. It explains how to install Eclipse with PyDev to develop Python applications. The same setup can also be used to develop web-based applications using Django. All the steps should be similar for Linux based systems including Ubuntu.
PyDev is a plugin that enables Eclipse for Python development. It adds the features to Eclipse for Python language which includes Code Completion, Code Analysis, Debugger, Interactive Console, Refactoring, Tokens Browser, Django Integration, etc. The main advantage of installing PyDev plugin is that it can be installed on the pre-installed Eclipse that is already available on the system. We can also do a fresh install of Eclipse as shown in this tutorial.
It also assumes that Python is already installed on the system. You may also be interested in How To Install Python On Windows.
Step 1 - Download Eclipse
Click on the Windows 64-bit link as highlighted in Fig 1. It will navigate to the download page as shown in Fig 2.
Click on the Download Button to start the download.
Step 2 - Install Eclipse
We can simply extract the zip file downloaded in the previous step to complete the installation. The files that ships with the zip are as shown in Fig 3.
You can also create a desktop shortcut icon to launch the Eclipse from the desktop. Launch the Eclipse by double-clicking on either the executable file or desktop shortcut added by you. It will show the option to configure the current workspace as shown in Fig 4.
Keep the checkbox unchecked as highlighted in Fig 4. It will show the workspace selection every time we launch the Eclipse IDE to choose the current workspace. After providing appropriate workspace location, click on the Launch Button to start Eclipse. It will show the Welcome Screen as shown in Fig 5.
Step 3 - Install PyDev Plugin
Click on Help -> Eclipse Marketplace to open the Eclipse Marketplace wizard. Search for PyDev on the marketplace. It will show the search results as shown in Fig 6.
Click on the Install Button to start installing the PyDev plugin for Eclipse. It will fetch the details of the plugin from the marketplace and shows the available options as shown in Fig 7.
Click on the Confirm Button to confirm the plugin installation. On the next window, it will ask to accept the License Agreement as shown in Fig 8.
Click on the Finish Button to complete the installation of PyDev plugin for Eclipse. In the end, it will also ask to restart the IDE.
Step 4 - Getting Started with Python - Hello World
This step shows how to start programming with Python by creating the Hello World Project.
Click on Windows -> Perspective -> Open Perspective -> Other to open the PyDev perspective for Python development as shown in Fig 9.
Choose the PyDev perspective and click on the Open Button to open the perspective.
With the PyDev perspective open, we will create the first Python project. Click on File -> New -> PyDev Project as shown in Fig 10 to start creating the project.
The next wizard shows the options to configure the Project as shown in Fig 11.
We can see that the project configuration wizard shows a link to configure the Python interpreter. Now click on this link to start configuring the interpreter. It will show the available options as shown in Fig 12.
Click on the Choose From List Button. It will show the available interpreters as shown in Fig 13.
Choose the main interpreter as highlighted in Fig 13 and click on the Ok Button. It will also ask to configure the python path as shown in Fig 14.
Keep the paths selected on click on the OK Button. It will configure the interpreter and shows the Default interpreter selected for the project as shown in 15. It will also ask for system permission to allow Eclipse to make required changes as shown in Fig 15.
Notes: We only need to configure the interpreter for the first project. It will show the list of available interpreters from second project onward and we can other more interpreter configuration if required.
Click on the Finish Button to complete project configuration and create the project. It will add the project on the projects list as shown in Fig 16.
Now click on File -> New -> PyDev Package as shown in Fig 17.
Provide an appropriate package name and click on the OK Button to create the package. It will ask to confirm PyDev preferences as shown in Fig 18.
Click on the OB Button to confirm the preferences. We can change them later if required.
A PyDev Package is a Python Package and Eclipse will create the ini file at the root of the package as shown in Fig 20.
Next, we will create our first Python Module to print Hello World on the console. Keep the package selected and right-click -> New -> PyDev Module to start creating the Module as shown in Fig 20.
It will ask for the module name. I have provided the module name as welcome. Click on the Finish Button to create the module. It will also ask to choose the module template as shown in Fig 21.
I have selected the Empty Template for this tutorial to keep it simple. Click on OK Button to configure the module template.
Now update the module file as shown in Fig 22.
Finally, we will execute the program to print the output on the console. Click on Run -> Run As -> Python Run to execute the program as shown in Fig 23.
It will execute the program and shows the output on the console as shown in Fig 24.
This is how we can install and configure the Eclipse for Python development. We have also created the first project and then added a package and a module to print Hello Python on the console.
Happy coding Python using Eclipse and PyDev !!