PyDev: Python Development
Plug-ins for Eclipse

Russell Bateman
December 2014
last update:

PyDev site links:


Installing PyDev

Steps to Python in Eclipse...

  1. Download your favorite Eclipse package.
  2. Explode and locate it in your filesystem.
  3. Edit eclipse.ini to point at JDK.
  4. Launch Eclipse.
  5. Launch Help → Eclipse Marketplace...
  6. Type "python" into search string and press Enter.
  7. Find PyDev and click install. During installation take defaults including clicking on something presented to you and accepting it.
  8. Launch Window → Preferences and click on PyDev.
  9. Expand Interpreters and click Python Interpreter.
  10. Click New... and name (arbitrary) the interpreter.
  11. Enter path (on Linux this is usually /usr/bin/python) or Browse to it.
  12. Click OK.
  13. Accept adding all the subdirectories proposed.
  14. Click OK.
  15. Add PyDev perspective: Window → Open Perspective... → Other and look for PyDev.

Create first project.

  1. Click PyDev button (upper-right) to put Eclipse into the PyDev perspective.
  2. Launch File → New... → PyDev Project.
  3. Name the project.
  4. Click Finish; the Finish button will be greyed out unless and until you've set up the Python interpreter for your local host as outlined earlier.
  5. Right-click the new project and choose New... → Source Folder, name it src.
  6. Repeat the previous step to create a test folder.

Create first Python code. The first code to create is a unit test (depending on your personal religious persuasion).

  1. Right-click the test folder and choose New... → PyDev Module; an individual Python code file is called a module.
  2. Name this file, demo.
  3. Take defaults including choosing <Emtpy> for the template.
  4. Into the new file, paste the following code:
    from unittest import TestCase, main as demo_main
    
    def IsOdd( n ):
        return n % 2 == 1
    
    class IsOddTests( TestCase ):
        def testOne( self ):
            self.failUnless( IsOdd( 1 ) )
        def testTwo( self ):
            self.failIf( IsOdd( 2 ) )
    
    def main():
        demo_main()
    
    if __name__ == '__main__':
        main()
    
  5. Save this file.
  6. Right-click the file in the PyDev Package Explorer and choose Run As → 2 Python unit-test.

I followed http://www.vogella.com/tutorials/Python/article.html for first project, debugging, etc. which worked admirably.