Install Eclipse 3.7 Indigo and configure Eclipse for Python

efthialex
  10 years ago
  26

1. Overview

1.1 What is Eclipse?

Eclipse is a platform that has been designed from the ground up for building integrated web and application development tooling. By design, the platform does not provide a great deal of end user functionality by itself. The value of the platform is what it encourages: rapid development of integrated features based on a plug-in model.

Eclipse provides a common user interface (UI) model for working with tools.  It is designed to run on multiple operating systems while providing robust integration with each underlying OS.  Plug-ins can program to the Eclipse portable APIs and run unchanged on any of the supported operating systems. 

At the core of Eclipse is an architecture for dynamic discovery, loading, and running of plug-ins. The platform handles the logistics of finding and running the right code. The platform UI provides a standard user navigation model.  Each plug-in can then focus on doing a small number of tasks well. What kinds of tasks? Defining, testing, animating, publishing, compiling, debugging, diagramming...the only limit is your imagination.

 

1.2 What is Python?

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.

Often, programmers fall in love with Python because of the increased productivity it provides. Since there is no compilation step, the edit-test-debug cycle is incredibly fast. Debugging Python programs is easy: a bug or bad input will never cause a segmentation fault. Instead, when the interpreter discovers an error, it raises an exception. When the program doesn't catch the exception, the interpreter prints a stack trace. A source level debugger allows inspection of local and global variables, evaluation of arbitrary expressions, setting breakpoints, stepping through the code a line at a time, and so on. The debugger is written in Python itself, testifying to Python's introspective power. On the other hand, often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective.

 

1.3. About this tutorial

This tutorial will explain how to install Eclipse 3.7, Python 3.2 and the Python plugin (PyDev) for Eclipse.

 

 

2. Installation

2.1 Eclipse

2.1.1 Donwload and install Eclipse [Software Manager]

First open your Software Manager from Menu Other  Software Manager and type in the search box "eclipse" without quotes and click on eclipse.

 

 

 

Now press the button install

 

 

Finally to launch Eclipse go to Menu Programming  Eclipse

 

 

2.1.2 Donwload and install Eclipse [Manually]

If for some reason you couldn't install Eclipse 3.7 indigo from Software Manager follow the following steps.

First you need to download Eclipse for 32bit or 64bit system. In my case I downloaded the 64bit version.

 

 

2.1.3 Extract it

Once you download the file locate it and extract it. I assume that the downloaded file is located in /home/Downloads. Open a terminal with Ctrl+Alt+T and type 

cd ~/Downloads (With this command we change the default directory "/" to "/Downloads") and then type

 

For 32bit version

tar xvf eclipse-SDK-3.7.2-linux-gtk.tar.gz to extract the file.

 

For 64bit version

tar xvf eclipse-SDK-3.7.2-linux-gtk-x86_64.tar.gz to extract the file.

 

2.1.4 Move to /opt folder

Opt is reserved for additional software you install. This is kind of like ‘Program Files‘ for linux.

Once you extract the file type the following commands invidually:

sudo mv eclipse /opt/

cd /opt

sudo chown -R root:root eclipse

sudo chmod -R +r eclipse

 

2.1.5 Create an eclipse executable in your path

To do this execute the following commands:

sudo touch /usr/bin/eclipse

sudo chmod 775 /usr/bin/eclipse

 

Now press Alt+F2 and type:

gksu gedit /usr/bin/eclipse

 

 

and copy paste the below code:

 

#!/bin/sh
#export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
export ECLIPSE_HOME="/opt/eclipse"

$ECLIPSE_HOME/eclipse $*

 

and finally save the file.

 

 

2.1.6 Create a gnome menu icon

To create a menu icon press Alt+F2 and type:

gksu gedit /usr/share/applications/eclipse.desktop

 

and copy paste the below code:

 

[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true

 

 

2.1.7 Launch Eclipse for the first time

Press Alt+F2 and type:

/opt/eclipse/eclipse -clean &

 

 

 

2.2 Python

2.2.1 Donwload Python

You can download Python from here.

 

2.2.2 Extract it

Once you download the file locate it and extract it. I assume that the downloaded file is located in /home/Downloads. Open a terminal with Ctrl+Alt+T and type 

cd ~/Downloads (With this command we change the default directory "/" to "/Downloads")

tar xzf Python-3.2.3.tgz to extract the file.

 

2.2.3 Install it

In the terminal type the following commands invidually:

 

cd Python-3.2.3

./configure

make

make test

sudo make install

 

Note: It will take some time, especially the command "make test".

Now we have Python 3.2 on our computer.

 

 

2.3 PyDev Plugin

PyDev is a Python IDE for Eclipse, which may be used in Python, Jython and IronPython development.

 

2.3.1 Donwload and Install PyDev Plugin

First open Eclipse and go to HelpInstall New Software...

 

 

In Work with: type  PyDev - http://pydev.org/updates and press tha button Add... Then check the first option PyDev and click Next

 

 

 

 

And the installation will begin.

Caution!

When you see the Selection Needed dialog box, you must manually check the box before pressing okay. If you do not, it appears that the installation is continuing, but it is not. You must uninstall PyDev, then reinstall.

 

 

And finally restart Eclipse

 

 

2.3.2 Configure PyDev

Go to Window Preferences. In the Preferences window, expand PyDev and select Interpreter-Python.

 

 

Click "New..." and type Python32 for the Interpreter name. For the Interpreter executable, browse to your copy of Python  /usr/local/bin/python3.2 , and press Open.

 

 

Click "OK" and the  Selection Needed Window will appear.

 

 

Select all but the PySrc and python32.zip and click OK as many times as necessary to exit the preferences.

 

 

The default selection should be fine. The Interpreter is now set up so that the code you write can be interpreted for the computer to run. You are now ready to start running code.

 

 

2.3.3 Your first Python programm in Eclipse

Select File New Project. Select Pydev Pydev Project.

 

 

Create a new project with the name "HelloWorld". Select Python version 3.0 and your interpreter Python32.Also check Create 'src' folder and add it to the PYTHONPATH?.

 

 

Press Finish.

 

Select Window Open Perspective Other. Select the PyDev perspective.

 

 

 

Select the "src" folder of your project, right-click it and select New PyDev Modul. Create a module "FirstApp".

 

 

 

Type in the source code print("hello World!")

 

 

From your menu find the Play button your model and select Run As Python run.

 

 

You will see Hello World in your console.

 

Comments
optimuspnj 7 years ago

Perfect and thanks. This is also working for newest version of python, "Neon".


espressoman 9 years ago

Good tutorial. Just a couple of minor points of slight confusion.
1) In a Mint install, the path for the interpreter executable is /usr/bin and not /usr/local/bin
2) Under eclipse 3.8.1, the 'Run as' from the main menu doesn't display the options as displayed above. However, right clicking does.


mihai_seba 11 years ago

thanks... it's a very good tutorial!


carlosues7 11 years ago

Thanks man, very good tutorial.


pavankm 11 years ago

Good Work Pal.


arturs_mezeckis 11 years ago

Noble of tutorials! Thx!


efthialex 12 years ago

Thank you everyone


kazztan0325 12 years ago

I completely agree with @Alexio .

All of the tutorials which have been created by @efthialex are models of tutorial.


Alexio 12 years ago

Very useful, thank you! This tutorial should be an example to follow for all the tutorial authors.


kazztan0325 12 years ago

Wonderful tutorial!


trollboy 12 years ago

Fantastic tutorial.


ivy_s 12 years ago

Great job!


efthialex 12 years ago

@prjolivet 

Thanks for the hint.


prjolivet 12 years ago

Yes great looking tutorial.I think it would be more simple to install Eclipse 3.7 from the mint repository (available on Lisa).


chassum 12 years ago

Great looking tutorial :)