Eclipse For Python Developers

Posted on  by admin
  1. Usually no-one mention but Eclipse do have Python support in its DLTK (dynamic languages toolkit) plugin set. You certainly may want to try it. Anyway it is not as much functional as PyDev plugin thus you can have it securely. PyDev asks to accept its certificate that is vulnerability to MIM attacks.
  2. PyDev is a plugin that enables Eclipse to be used as a Python IDE (supporting also Jython and IronPython). It uses advanced type inference techniques which allow it to provide things such as code completion and code analysis, besides providing a debugger, interactive console, refactoring, tokens browser, django integration, etc.
  3. Configuration of Eclipse You also have to maintain in Eclipse the location of your Python installation. Open in the Window Preference Pydev Interpreter Python menu. Press the New button and enter the path to python.exe in your Python installation directory.
  4. Eclipse Che is a developer workspace server and cloud IDE. A modern, open source software development environment that runs in the cloud.

This article describes how to set up Eclipse for Django development on Windows. The software used is as follows:

  • Python 3.4
  • Django 1.7.1
  • PyDev 3.8.0
  • Eclipse Luna JEE 64-bit Windows Edition
  • Windows 7

To set up Eclipse for Django on Windows, use the following steps:

  1. Install Python. Download and install Python from here: https://www.python.org/downloads/
  2. Modify Your Path. Modify your path to include the location of Python as well as it’s Scripts and ToolsScripts directories. For example, if python was installed to C:Python34, your path should contain the directories shown below:
  3. Set Up a Python Virtual Environment. Python 3.4 comes with pyvenv that can be used to set up a virtual environment, which creates a separate Python environment, so that you can modify it without affecting the system Python environment. For more information, see; https://docs.python.org/3/library/venv.html. Use the following command:

    For example:

    1. Activate the Virtual Environment. Go to the virtual environment’s Scripts directory and execute the activate command. This will prepend the path for the virtual environment to your path, so that the virtual environment’s Python commands will be used. Here is an example:
    2. Install Django. Use pip (a package management too that is included with Python 3.4) to install django. In your Python virtual environment directory, with the virtual environment activated, execute the following command:

      For example:

    3. Install Eclipse. Download Eclipse from here: https://www.eclipse.org/downloads/. I downloaded the JEE version of Eclipse, because it supports web apps, and I also develop in Java. Other versions could be used. To install, unzip the downloaded file to a directory of your choice.
    4. Install PyDev. Install the PyDev plug-in for Eclipse, which supports Python and Django development. In Eclipse:
      1. Select Help → Install New Software... from the menu bar.
      2. In the Install dialog that should come up, enter the text below for the “Work with” field and then click on the Next button.
      3. An Install Details dialog should come up that lists PyDev Eclipse as the item to be installed. Click on the Next button.
      4. A Review Licenses dialog should come up. Accept the terms of the license and click on the Finish button.
      5. A dialog should come up asking you if you trust the PyDev certificates. Select the certificate and click on the OK button.
      6. You will need to restart Eclipse after the PyDev install, and a dialog should come up asking you if you want to do that. Click on the Yes button.
    5. Create a Django Project. After restarting Eclipse with a new workspace specified:
      1. Select File → New → Other… from the menu bar.
      2. In the Select a wizard dialog that should come up, select PyDev → PyDev Django Project and click on the Next button:
      3. In the PyDev Django Project dialog that should come up:
        1. Enter a project name, for example: mysite
        2. Select the closest Grammar Version to 3.4 (3.0 was the closest available with the version of PyDev used).
        3. Click on the Please configure an interpreter before proceeding. link.
        4. In the Configure interpreter dialog that should come up, click on the Manual Config button.
        5. In the Preferences dialog that should come up, click on the New button in the Python Interpreters section of the dialog.
        6. In the Select interpreter dialog that should come up, enter an interpreter name, and select the Python executable in the virtual environment that you created, and click on the OK button. For example:
        7. A dialog should come up where you select the directories to add to the SYSTEM pythonpath/. Click the OK button.
        8. You should come back to the Preferences dialog. Use drag and drop to reorganize the library directories, so that the virtual environment directories are listed before the system directories. Your preferences dialog should look something like what is shown below. When done, click on the OK button.
        9. You should now come back to the Python Django Project dialog. For the interpreter, select the one that you just created and then click on the Next button.
        10. A Reference page dialog should come up. Just click on the Next button.
        11. A Django Settings dialog should come up. Sqlite should be the default database system specified, so to use sqlite, just click on the Finish button. If you want to use another database system, enter the appropriate information in this dialog and then click on the Finish button.
        12. A dialog should come up asking if you want to use the PyDev perspective. Click on the Yes button.
    6. Run the Django Project.
      1. In Eclipse, click on the Run button:
      2. A Run As dialog should come up. Select PyDev: Django and click on the OK button. You should see the following in your Console view:
      3. Check your site by accessing http://localhost:8000. You should see something like the following:

Eclipse is not a new term that programmers will hear. It is very popular in the developer community and has been in the market for a very long time. This article is all about showing how to set up Python in Eclipse using the PyDev package. Eclipse is an Integrated Development Environment (IDE) used for Java development.Other than Java it also supports other languages like PHP, Rust, C, C, etc.

Ide

Install Python and Java before installing Eclipse.

Download Eclipse For Python Developers

You may want to print these instructions before proceeding, so that you can refer to them while downloading and installing Eclipse. Or, just keep this document in your browser. You should read each step completely before performing the action that it describes. This document shows downloading and installing Eclipse on Windows 7 in Winter 2017.

Eclipse: (Neon)

The Eclipse download requires about 250 MB of disk space; keep it on your machine, in case you need to re-install Eclipse. When installed, Eclipse requires an additional 250 MB of disk space.

Downloading

  1. Click Eclipse

    The following page will appear in your browser. In this handout we will download Eclipse IDE for Eclipse Committers for Windows 32 Bit; if your computer uses Windows, continue below; otherwise choose either Mac Cocoa or Linux instead.

    It is critical that Java, Python, and Eclipse are either all 32 Bit or are all 64 Bit (and only if your Machine/OS supports 64 Bit): I think it easiest to use 32 Bit for everything.

  2. Click the 32-Bit (after Windows) to the right of the Eclipse IDE for Eclipse Committers.

    You will see the following page (don't worry about the name of the institution underneath the orange DOWNLOAD button).

  3. Click the orange DOWNLOAD button. The site named here, in orange to the right of the button: Canada - University of Waterloo Computer Science Clupb (http) is the random one chosen by the download page this time; yours may differ.

    This file should start downloading in your standard download folder, while showing a splash screen about donating to Eclipse. This file is about 250 Mb so it might take a while to download fully if you are on a slow internet connection (it took me about 5 minutes over a cable modem). Don't worry about the exact time as long as the download continues to make steady progress. In Chrome progress is shown on the bottom-left of the window, via the icon

    The file should appear as

    Terminate the window browsing the Eclipse download.

  4. Move this file to a more permanent location, so that you can install Eclipse (and reinstall it later, if necessary).
  5. Start the Installing instructions directly below.
Eclipse For Python DevelopersEclipse For Python Developers

Installing (for Python)

Python and Java should be installed before installing Eclipse

Eclipse For Python Developers Download

  1. Unzip eclipse-committers-newon-2-win32.zip, the file that you just downloaded and moved.
    On my machine (running Windows 7), I can
    • Right-click the file.
    • Hover over the IZArc command from the menu of options.
    • Click Extract Here

    If you do not have IZArc or an equivalent unzipping program, here is the web site to download a free copy of IZarc.

    Unzipping this file creates a folder named eclipse; unzipping 250 MB can take a few minutes. You can leave this folder here or move it elsewhere on your hard disk. I recommend putting the downloaded file and resulting folder in the C:Program Files directory.

  2. Create a shortcut on your desktop to the eclipse.exe file in this eclipse folder:
    On most Windows machines, you can
    • Right-press the file eclipse.exe
    • Drag it to the desktop.
    • Release the right button.
    • Click Create shortcut here

    Now you are ready to perform a one-time only setup of Eclipse on your machine.

  3. Double-click the shortcut to Eclipse that you just created above.

    The following splash screen will appear

    and then an Eclipse Launcher pop-up window will appear.

    In the Workspace text box, your name should appear between C:Users and workspace, instead of Pattis.

    Leave unchecked the Use this as the default and do not ask again box. Although you will use this same workspace for the entire quarter (checking projects in and out of it), it is best to see this Workspace Launcher pop-up window each time you start Eclipse, to remind you where your workspace is located.

    In fact, it is a good idea to create on your desktop a shortcut to your workspace folder; but you must click OK (see below) before Eclipse creates this folder and you can create a shortcut to it.

  4. Click OK.

    Progress bars will appear as Eclipse loads.

    Eventually the Eclipse workbench will appear with a Welcome tab covering it.

  5. Terminate (click X on) the Welcome tab.

    You will not see the Welcome tab when you start Eclipse again, after this first time.

  6. Click Help (on the far right of the line below this window's blue title Java - Eclipse) and then click Install New Software... in its pull-down menu, as shown below.

    The Install pop-up window will appear.

  7. Enter the text (or cut/paste from this document) http://pydev.org/updates into the Work with text box and press Enter (if that doesn't work, try http://www.pydev.org/updates).

    In a few seconds the information under Name should change from
    There is no site selected to Pending to

    Select only the top PyDev checkbox; do NOT select the PyDev Mylyn Integration (optional) box.
    Check before proceeding that the Install pop-up window appears as

  8. Click Next >

    A new Install pop-up window will appear.

  9. Click Next >

    A new Install pop-up window will appear.

    Select the I accept the terms of the license agreement radio button, so the window appears as

  10. Click Finish

    An Installing Software pop-up window will appear. During installation, it will show the various operations it is performing and a progress bar for each one. Because the installer is fetching various files online, this process might take a few minutes.

    If you see a Security Warning pop-up window

    Click OK.

    The installation will pause, and a Selection Needed pop-up window appears.

  11. Check the box labeled Brainwy Software; Pydev; Brainwy.

    Check before proceeding that the Install pop-up window appears as

  12. Click OK

    The installation will finish (showing the final progress bars).

    A Software Updates pop-up window will appear.

  13. Click Yes

    Eclipse will terminate and restart. As you did in step 4, terminate (click OK on) the Welcome Tab.

  14. Click Window (to the left of Help on the far right of the line below this window's blue title workspace Java - Eclipse) and then click Preferences in its pull-down menu, as shown below.
  15. Drill down to select the interpreter:
    • Disclose PyDev by clicking the + in front of PyDev or double-clicking PyDev (after the +); the + changes to a -.
    • Disclose Interpreters by clicking the + in front of Interpreters or double-clicking Interpreters (after the +); the + changes to a -.
    • Select Python - Interpreter.
    The Preferences pop-up window should appear as follows
  16. Click New... at the top-right of the top window

    A Select Interpreter pop-up window appears.

    Click Browse and the Open pop-up window should show you the folder in which Python was installed (here Python 3.6).

    Double-click python.exe (or select it and click Open).

    Change the Name in the Select Interpreter pop-up window to be simply Python36 (or whatever version of Python is installed). The Select Interpreter pop-up window should appear as

  17. Click OK.

    A Selection needed pop-up window will appear.

    Ensure that a check appears in all four checkboxes.

  18. Click OK.

    The Preferences pop-up window will be changed to

    On my system the path to the Python interpreter was so long, not all of it could be seen under Location

  19. Click OK.

    A Progress Information pop-up window will appear.

    During installation, it will show the various operations it is performing and a progress bar for each one. Eventually the installation will terminate.

    If the following pop-up window appears

    Ensure the 'Public networks, such as those in airports....' checkbox is NOT checked, and then click Allow Access.

  20. Click Window (to the left of Help on the far right of the line below this window's blue title workspace - Java - Eclipse), hover over Perspective then Open Perspective in the pull-down menu and then click Other... in the next pull-down menu.

    The Open Perspective pop-up window will appear.

  21. Double-click PyDev (third from the bottom)

    The blue label on the Eclipse window will change to workspace - PyDev - Eclipse, the Package Explorer in the upper-left tab will change to PyDev Package Explorer, and a PyDev icon will appear to the right of the Java icon.

  22. Right-click the Java icon to the left of the PyDev icon and select close

    The Eclipse workbench will now have only the PyDev icon here and will look like

  23. Locate the workspace folder created in step 3 (see C:Usersyournameworkspace) and download the courselib.zip file into this workspace and unzip it there, producing the courselib folder; it should should contain a bunch of Python module files (ending in .py). From time to time you will be asked to put other course-specific Python module files into this courselib folder; these modules will be usable in all Python projects in Eclipse.
  24. Inform Eclipse to use the courselib folder in all Python projects.
    • Select Window Preferences.
    • Disclose PyDev by clicking the + in front of PyDev or double-clicking PyDev (after the +); the + changes to a -.
    • Disclose Interpreters by clicking the + in front of Interpreters or double-clicking Interpreters (after the +); the + changes to a -.
    • Select Python - Interpreter.
    • Click the Libraries tab (leftmost, above the bottom pane)
    • Click the New Folder button (topmost, right of the bottom pane)
    • Browse to the courselib folder (added above) in the Browse for Folder pop-up window (C:Usersyournameworkspacecourselib).
    • Click the courselib folder selected, and then click OK
    • Click Apply (you will see some progress bars)
      The < />< />< b=' /> pop-up window should now appear as

      Notice a fifth entry (ending in courselib appears at the bottom of the bottom pane named System PYTHONPATH

      < />< />
    • Cick OK
  25. Terminate (click X on) the Eclipse window.

Eclipse Ide For Java Ee Developers Python

Eclipse is now installed for Python.