Sunday, 8 December 2013

Install Python Plugin in Eclipse

If you have any Eclipse and you want to python environment in eclipse then you have to install plugin in eclipse then you can achieve environment of python and python related all module.

Because this plugin takes all software update which is installed in python. it will automatically configure when u install plugin.

Go through below steps
Step 1: Install python plugin in eclipse

Note: Instructions are targeted at Eclipse 3.5 onwards
To install Aptana plugin Extensions using the Eclipse Update Manager, you need to use the Help > Install New Software... menu
image0







To install PyDev and PyDev Extensions using the Eclipse Update Manager, you need to use the Help > Install New Software... menu (note that in older versions, this would be the 'Find and Install' menu).
 image0

In the next screen, add the update site(s) you want to work with ( See below for a list with the available update sites).

Main:
Nightly builds:
After entering the update sites, select the update site you entered or select "All available sites" and add a filter for PyDev, so that it shows the contents of all the update sites that have PyDev, then select what you want to install and click 'Next'.
image1
Then, UNCHECK the 'Contact all update sites during install to find required software' and press 'Next' again to confirm your selection.
image2
And finally, read the license agreement and if you accept, select the accept radio button and click 'Finish'.
image3
At that point, Eclipse should automatically download the plugin contents and present you to a dialog asking if you want to restart (to which you should say yes).

 Step 2: Configuration of Eclipse 

You also have to maintain in Eclipse the location of your Python installation. Open in the WindowPreferencePydevInterpreter Python menu.



Press the New button and enter the path to python.exe in your Python installation directory. For Linux and Mac OSX users this is normally /usr/bin/python. 

  1. Click "New..." and type Python32 for the Interpreter name. For the Interpreter executable, browse to your copy of Python (C:\Program Files\Python32\python.exe), and press Open.
     

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

Writing Your First Python Program

    1. Go to Window → Open Perspective → Other and choose PyDev, then click OK. If you look at the upper right corner you will see that the perspective has changed from "Java" to "PyDev".
    2. Perspectives are designed to have the most useful tools within reach for whatever task you are doing (for example writing Java code or writing Python code). If you look in the File→ New menu you will see that there are different options with the different perspective.
      PyDev Perspective Java Perspective
      As you can see, perspectives greatly affect the look of the Eclipse program.
  1. Create a new project
    1. Go to File → New → PyDev Project to start a wizard.
    2. In the next window that appears, enter the name of your project and select "python"  and 3.0"; as the type. Make sure "create default 'src' folder and add it to the pythonpath?" is selected. Click Finish.
    3. If you look at the upper left corner of the workspace (in the Package Explorer view), you should now see your newly created project with a "src" folder inside.
  2. Create a new module
    1. Select the project you just created and go to File → New → PyDev Module. This will launch a new PyDev Module Wizard where you should enter a name for your module and make sure it is in the right location. Leave the Package field blank and select Finish.
    2. Look in the Package Explorer view and you will see an icon of your new file inside the src folder, which Eclipse created when you made the new project before.
      The file should be opened in the open space in the center of the workspace-the Editor view. (If not, right click on the greeting.py icon and select Open.) You will see a tab with the name of your file.
  3. Write and run the program
    1. Here's a program to greet the world. Simply type print('Hello, World!') into the file. You may remove the default doc comment or leave it there; Python ignores it.
    2. Right click on the file and select Save (or press Ctrl+S) to save the file.
    3. Finally, choose the greeting.py icon, and go to Run → Run As → Python Run to run your program. (A quicker alternative is to right-click on the greeting.py icon, and select Run As → Python Run, or press Ctrl+F11.)
    4. Look at the bottom of your screen at the Console view and you will see the message you told the computer to print.
      Congratulations! You have written your first program with Python.

 Thanks guys

No comments:

Post a Comment