Eclipse configuration Python's development environment

Source: Internet
Author: User

The first article is about Eclipse Built in Python development environment, the second, mainly about some configuration.

First article:

in the Eclipse Built in Python Development Environment

Body

First we need to understand a little bit of--eclipse as a very good development tool, it can be used as an n multi-language IDE, but only if we need to install the corresponding compiler or interpreter. For example, common Java development requires JDK. So Python development with Eclipse also has to be Python's "JDK", the Python interpreter. The author has installed the Python2.7 version of the interpreter, in this article Python2.7 as an example of the steps to explain the construction process.

Basic requirements:

1 Eclipse (version not too old)

·2 python Interpreter (www.python.org)

Step 1:

Download the plugin Pydev for developing python in Eclipse.

File name: Org.python.pydev.feature-1.6.1.2010080312.zip.

: http://sourceforge.net/projects/pydev/files/

Note: As of 2010-8-20, the above documents are the latest version.

Step 2:

Unzip the Org.python.pydev.feature-1.6.1.2010080312.zip. The installation of the Pydev plugin was successful by copying the contents of the extracted features and plugins folders to the same folder in the Eclipse installation directory.

Add:

Another way to install Pydev

Before installing PyDev, ensure that you have installed Java 1.4 or later, Eclipse, and Python. Next, start installing the PyDev plugin.

1 start Eclipse and install PyDev with Eclipse Update Manager. Find the Help bar in the Eclipse menu bar, select Help > Software Updates >find and Install.

2 Select Search for new features for install, and then click Next. In the window that appears, select New remote site. A dialog box pops up asking you to enter the name and link of the new update site. Here, the name entry PyDev, of course, you can also enter a different name, the link input http://www.fabioz.com/pydev/updates, you can also fill http:// Pydev.sourceforge.net/updates. Then, click Ok.


Figure 1. New Update Site

3 In this way, a new Pydev site is built, select the site, and then Finish. Next, Eclipse's update Manager will search for the installation package in the site you just entered, check the results of the search PyDev, and click Next.


Figure 2. Installing Pydev

4 Read the license Terms and, if accepted, click Next. Go to the Installation Path selection screen, use the default settings, and then Finish.

5 Eclipse Update Manager will download PyDev and you can see the progress of the download from the Eclipse taskbar. After downloading, display a screen that requires you to confirm the installation, click Install all to start the installation.

After installation, you need to restart Eclipse for the installation to take effect.

Verify that PyDev is installed successfully

How can I verify that Eclipse Update Manager has successfully installed the required PyDev plugin?

Selecting Help->about eclipsesdk->plug-in Details will appear in the About Eclipse SDK plug-ins window, which lists all installed Eclipse plugins. Check if there are at least five plugins in the plug-in Id column that start with Com.python.pydev and Org.python.pydev respectively. If so, then the Pydev has been successfully installed, otherwise, the installation of some problems, need to be based on specific problems to do specific analysis.


Figure 3. Verifying the PyDev plugin

Configure PyDev

After installing the PyDev, the Python/jython interpreter needs to be configured and the configuration process is simple.

In the Eclipse menu bar, choose Window > Preferences >pydev > Interpreter-(Python/jython), where you configure the Python/jython interpreter, below with Python For example, describe how to configure.

You first need to add an already installed interpreter. Here, Python is installed under the C:\Python25 path. Click New, select the Python interpreter python.exe, open a window with many checkboxes, select the path you want to add to the system PYTHONPATH, and click Ok.

Step 3:

Open Eclipse (restart eclipse if it is already open). Select window--"Presences, set

Expand Pydev, select Interpreter-python, click New ... button, click Browse in the pop-up selectinterpreter window ... button to locate the Python interpreter that is already installed. Click the OK button in the Select Interpreter window, click the Select All button in the pop-up selectionneeded window, and then click the OK button to complete the setup. Then select apply--"OK in the Preferences window to complete the setup.

Python 3.x is required in the following steps, Python 2 is optional. I'm more used to Unicode, so I set it here once.


2, General->editors->text editors->spelling,encoding changed into Other:utf-8


3, General->workspace,text file encoding changed to Other:utf-8


4, find the installation directory of \plugins\org.python.pydev.debug_x.x.x.yyyymmddhh\pysrc\pydevd.py,
920 lines of encoding = Non changed to encoding = "UTF-8", save

At this point, the Pydev configuration is complete.

Step 4:

Choose file--"new--" other. In the new window that pops up, press action:

Step 5:

In the pop-up window, fill in the Project name (project name)--Select project type (project type)--Choose the version number (if you don't have a version number that you're using)-"Select Directory Choose the version number older than your version number)--"SELECT interpreter (Interpreter)-Click the Finish button to complete the setup."

Note: Because the python you installed is version 3.1, Grammerversion chooses 3.0.

Step 6:

You can now create a new module in the project you have created,

We create an empty HelloWorld module in the SRC package,

Step 7:

As shown, write a simple HelloWorld script and run it.

Above is the whole content, if in doubt welcome message discussion.

2010-8-20 in Shenzhen

from : http://hi.baidu.com/hqwfreefly/blog/item/2543181d0afd9604314e150e.html

Second article:

Third, configure Python This is also the focus

Py3 is UTF-8 encoded by default. Cancel U ' ... ' The form of Unicode text indicates that the data type that holds the text is str, and the data type that holds the data is bytes. Because UTF-8 encoding is used by default, as long as the character encoding of the. py file is also utf-8 format, it is not necessary to declare the encoding type of the program in the head, that is, you do not have to write #-*-coding:utf-8-*-, the test does. So the Pydev encoding is also changed to UTF-8:

1. Under Eclipse IDE, open the window->preferences ... dialog box and select "PyDev", "Interpreterpython " from the tree list on the right. Click the new or AutoConfig button, select Python.exe from the Python installation path, and a dialog will pop up to let you tick the system PYTHONPATH, which I have chosen, should not matter. Last click OK, exit.




2, change the encoding method:

A): Select "general>>editors>>texteditors>>spelling" to set encoding to UTF-8:




b) Set the workspace encoding as: UTF-8:


Well, the installation is complete now. But it doesn't work, and if you have Chinese in Python code, the debug code goes wrong:

Solution: When writing a program, add a line of code to the beginning of the file #encoding:utf-8

Then run to show it.

Eclipse configuration Python's development environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.