Tuesday, June 26, 2012

Python in Eclipse [PyDev plugin for Eclipse]

While learning python, one question I had was, which python IDE to use? There are many options but being a Java developer I wanted to have something like Eclipse and it turned out that there is a plugin for eclipse which can be used for Python development with the auto-suggest, run, debug and many other features.

The plugin for eclipse is called PyDev and it's very easy to configure. 
Note: I work on a windows machine, so all the instructions are around a windows machine. 
  • Get Python:
    • Download the recent version of python from python.org.
    • Run the setup file (python-.msc) and follow the install insrtuction. 
    • Once the installation is complete, set the windows environment variable to point to the python installation folder.
      • Right click on "My Computer".
      • Select "properties". 
      • Click on the button "Environment Variables" under the tab "Advanced".


      • Add the path of python installation to the PATH variable, in my case its "D:\Python27\".


    • Go to dos command line and type the command ">python", if it takes you to the python command line, then it works.


  • Get Eclipse and install the PyDev plugin.
    • Download a version of Eclipse IDE from here do the setup you need for other dev. 
    • Now from Eclipse menu go to Help -> Install New Software
    • Add the PyDev update site http://pydev.org/updates.


    • Install the plugin. 
  • Configuration of Eclipse. 
    • From eclipse menu, open Window -> Preferences.
    • Look for PyDev -> Interepreter - Python.
    • Click on new and add the python.exe.
      • For windows, it was under the python installation i.e. d:\python27.
      • For linux, find it by running the command >which python






And all done, you are good to go... Play with python in eclipse.


Also check out my new post on Python-pip tool. 

No comments: