User Tools

Site Tools


python:pydeveclipse

Python Editor with pydev plugin on Eclipse

Install pydev on Eclipse and Configure

pydev run with java8

Install Pydev plugin for Eclipse

refer: http://www.pydev.org/manual_101_install.html The following assume that you have already Eclipse installed:

  1. You must install jdk8 to run eclipse
  2. Go to Help > Installation details and look for 'java.home' . Then to actually import it, in the command line, go to the Eclipse 'java.home' directory and execute:
    bin/keytool.exe -import -file pydev_certificate.cer -keystore lib/security/cacerts

    ⇒ your password when requested should be changeit

  3. Select Help→Install New Software to open Eclipse update manager Diaglog. Install PyDev via the Eclipse update manager via the following update site: http://www.pydev.org/updates
  4. Or install via Help → Eclipse Marketplace and search “pydev”
  5. Remove: Go to Help > Installation details > Installed Software and remove it

configuration Pydev on Eclipse

  1. Open in the Window → Preference → Pydev → Interpreter Python menu
  2. Press the New button and enter the path to python.exe in your Python installation directory
  3. The result should look like the following

Your first Python program in Eclipse

  1. Select Window→Open Perspective →Other. Select the PyDev perspective.
  2. Select File → New → Project. Select Pydev → Pydev Project.
  3. Create a new project with the name “de.vogella.python.first”. Select Python version 2.6 and your interpreter.Press Finish
  4. Select the “src” folder of your project, right-click it and select New → PyDev Modul. Create a module “FirstModule”.

Debug

  • Just right-click in the source code and add a breakpoint.

  • Then select Debug as → Python Run
  • You can now inspect and modify the variables in the variables view.

Via the debug buttons (or shortcuts F5, F6, F7, F8) you can move in your program. You can use F5 / F6, F7 and F8 to step through your coding.

Import pre-Existing python project

  1. Select Window→Open Perspective →Other. Select the PyDev perspective.
  2. right click on the project pan and click import
  3. From the list expand General and select existing project into workspace.
  4. Select root directory by going next
  5. Optionally you select copy projects into workspace

Import scrapy project and debug

Import Scrapy Project

  1. Create new pydev project, for example
  2. Copy existing scrapy project to directory myscrapy
  3. Refresh the scrapy project in eclipse

Config run and debug scrapy

  1. Go to Run→Debug Configuration to open Debug Configuration dialog
  2. Create new configuration myscrapy in menu Python run
  3. Config below parameters:
    • Main→Main Module:d:\tools\Python27\Lib\site-packages\scrapy-0.22.2-py2.7.egg\scrapy\cmdline.py
    • Arguments→Program Arguments: crawl dmoz

Config run and debug scrapy tests

  1. Go to Run→Debug Configuration to open Debug Configuration dialog
  2. Create new configuration scrapyunittest in menu Python unittest
  3. Config below parameters:
    • Main→Main Module:d:\tools\Python27\Lib\site-packages\Scrapy-0.22.2-py2.7.egg\scrapy\tests\test_engine.py
python/pydeveclipse.txt · Last modified: 2017/03/11 09:15 by admin