Python with eclipse + PyDev.

As for the Python development environment, eclipse + PyDev is quite powerful. For the time being, in this post I will write about the introduction of eclipse and PyDev.

What you can do with this combination. ・ Code completion ・ Display of code document -Debugging with interactive console -Update variable values at run time · Conditional breakpoints ・ Exception breakpoint -Context switching while stopping at a breakpoint ・ Automatic source code format ・ Code coverage measurement ・ Code evaluation (PyLint) ・ Profiling (cProfile) ・ Source code control with Git (Git)

Java is required to run eclipse, but this post uses the Java execution environment that comes with CentOS by default. Python also lays sideways and uses the execution environment that is included in CentOS by default.

    1. install eclipse Download the package from the eclipse site. http://eclipse.org/downloads/ There is no package for Python, so download it for Java. (Eclipse is based on Java, so this is like a minimal package) 1.png

Download from the nearest server. 1.png

For now, extract it to / usr / local. tar zxvf / home / \ / download / eclipse-java-luna-SR2-linux-gtk-x86_64.tar.gz -C /usr/local 1.png 1.png

You can now start eclipse by running / usr / local / eclipse. 1.png

The first time you start it, you will be asked where to save the project. I think there is no problem by default. It is annoying to ask for the location every time you start up, so check "Use this as the default and do not ask again" and press the OK button. (You can change the location of the workspace later) 1.png Please close the Welcome tab. 1.png

  1. Install PyDev in eclipse. Select "Help"-> "install New Software ..." from the menu. 1.png

Enter "http://pydev.org/updates" in "Work with:" and press the Enter key. 1.png

Select PyDev and press the "Next" button. 1.png

Just press the "Next" button. 1.png

The license details will be displayed. Select "I accept the terms of the license agreements" and press the "Finish" button. 1.png

A confirmation of the certificate will be displayed on the way, so check it and press the OK button. 1.png

You will be asked if you want to restart eclipse, so press the "Yes" button. 1.png

    1. Set up PyDev. First, close the Java perspective (a perspective is literally a "perspective", but it's more like a workspace). Right-click Java in the upper right and select Close. 1.png

Click the "+" -like icon in the upper right to add a perspective. 1.png Select PyDev and press OK. 1.png The PyDev perspective has opened. 1.png

Next, select the menu "Windows"-> "Preferences" to display the settings dialog. 1.png

Select PyDev → Interpreters → Python Interpreter. Click the "New ..." button on the upper right to register the Python interpreter (executable file). 1.png

For "Interpreter Name:", enter an arbitrary name (enter Python27 here), and for "Interpreter Executable:", enter the Python executable path "/ usr / bin / python" that is included by default in CentOS. Press the OK button. 1.png

The Python path will be detected automatically, so press the OK button. 1.png

Press the OK button to close the setting screen. 1.png

This completes the basic settings.

    1. Create a Python project and execute the code. Select the menu "File"-> "New"-> "PyDev Project". 1.png

Enter any project name in "Project name:". "Grammar Version" selects the Python version to use. Here, the version of Python that is included in CentOS 7 by default is selected. This version includes syntax checks during development and more. "Interpreter" selects the Python execution module that you registered yourself. Since you can register multiple Python interpreters, do not leave it as Default in consideration of the future, but select it properly. (For example, you can register Python2.7 and Python3.4 and use them properly depending on the project.) Press the "Finish" button. 1.png

Next, create the module. Select the menu "File"-> "New"-> "PyDev Module". 1.png

Enter any package name in "Package" and any module name in "Name" and press the "Finish" button. 1.png

When creating the module for the first time, the following confirmation screen will be displayed. There is no problem if you press the OK button as it is. -Wait for build process before execution: Do not wait -Build if necessary before execution: Do not build -Recheck every time the PyDev editor is opened. 1.png

You can select the template registered in PyDev. Here, select "Module Main" and press the OK button. (You can edit the template yourself or add a new one. If you do not want to apply the template, select "Empty") 1.png

When you create the module for the first time, you should see this screen as well. This is a message from Fabio, who is currently maintaining PyDev. Click the read "Read it" button to close it. 1.png

Rewrite the "pass" part to "print'Hello egg!'" And save. 1.png

Select the menu "Run"-> "Run As"-> "Python Run". 1.png

You should see "Hello egg!" In the console below. 1.png

Thank you for your hard work.

Recommended Posts

Python with eclipse + PyDev.
FizzBuzz with Python3
Scraping with Python
Statistics with python
Scraping with Python
Python with Go
Twilio with Python
Integrate with Python
Play with 2016-Python
AES256 with python
Tested with Python
python starts with ()
with syntax (Python)
Bingo with python
Zundokokiyoshi with python
Excel with Python
Microcomputer with Python
Cast with python
Notes for using python (pydev) in eclipse
Serial communication with Python
Zip, unzip with python
Django 1.11 started with Python3.6
Primality test with Python
Socket communication with Python
Data analysis with python 2
Scraping with Python (preparation)
Try scraping with Python.
Learning Python with ChemTHEATER 03
Sequential search with Python
"Object-oriented" learning with python
Run Python with VBA
Handling yaml with python
Eclipse + Pydev + GAE development
Solve AtCoder 167 with python
Serial communication with python
[Python] Use JSON with Python
Learning Python with ChemTHEATER 05-1
Learn Python with ChemTHEATER
Run prepDE.py with python3
1.1 Getting Started with Python
Collecting tweets with Python
Binarization with OpenCV / Python
3. 3. AI programming with Python
Kernel Method with Python
Non-blocking with Python + uWSGI
Scraping with Python + PhantomJS
Posting tweets with python
Drive WebDriver with python
Use mecab with Python3
[Python] Redirect with CGIHTTPServer
Voice analysis with python
Think yaml with python
Operate Kinesis with Python
Getting Started with Python
Use DynamoDB with Python
Zundko getter with python
Handle Excel with python
Ohm's Law with Python
Primality test with python
Run Blender with python
Solve Sudoku with Python