Configure eclipse + Python + pydev + tornado in windows and use pylint for static Detection

Source: Internet
Author: User
Before installing pydev, make sure that you have installed Java 1.4 or later, eclipse, and Python (add c: \ python26 to the environment variable path ). Next, install the pydev plug-in.

Install pydev using eclipse update manager. On the eclipse menu bar, find help> Software Updates> Find and install.
Select search for new features for install and click Next. In the displayed window, select new remote site. In this case, enter pydev as the name item. Then, click OK.

Select All pydev content ..... Install

Verify if pydev is successfully installed

Select help-> about eclipse SDK-> plug-in details to display the about eclipse SDK plug-ins window, which lists all installed Eclipse plug-ins. Check whether there are at least five plug-ins starting with COM. Python. pydev and org. Python. pydev in the plug-in ID column. If yes, pydev has been successfully installed. Otherwise, some problems may occur during installation. You need to analyze the problems according to the specific problems.

Configure pydev

After installing pydev, You need to configure the python/Jython interpreter. The configuration process is simple.

On the eclipse menu bar, choose Window> preferences> pydev> interpreter-(Python/Jython). Configure the python/Jython interpreter here. The following describes how to configure python.

First, you must add an installed interpreter. Here, python is installed in the path c: \ python26. Click new and select Python interpreter python.exe. A window containing multiple check boxes is displayed. Select the path to be added to the system pythonpath and click OK.

Next, check whether the configuration result is correct.

In preference> pydev> Python interpreter, check whether the paths added during the configuration process are included. All library folders required by the system are listed here.

In addition, the built-in Python libraries are listed in forced builtin libs. For python, there are about 50 built-in libraries and about 30 built-in libraries for Jython.

In this way, the python interpreter is configured.

Next, install tornado-1.1.

C: \ Documents ents and Settings \ Evan> E:

E: \> Cd tornado11_path

E: \ tornado11_path> Python setup. py build
Running build
Running build_py
Creating build
Creating build \ Lib
Creating build \ Lib \ tornado
Copying tornado \ Auth. py-> build \ Lib \ tornado
Copying tornado \ autoreload. py-> build \ Lib \ tornado
Copying tornado \ database. py-> build \ Lib \ tornado
Copying tornado \ escape. py-> build \ Lib \ tornado
Copying tornado \ httpclient. py-> build \ Lib \ tornado
Copying tornado \ httpserver. py-> build \ Lib \ tornado
Copying tornado \ httputil. py-> build \ Lib \ tornado
Copying tornado \ ioloop. py-> build \ Lib \ tornado
Copying tornado \ iostream. py-> build \ Lib \ tornado
Copying tornado \ locale. py-> build \ Lib \ tornado
Copying tornado \ options. py-> build \ Lib \ tornado
Copying tornado \ s3server. py-> build \ Lib \ tornado
Copying tornado \ stack_context.py-> build \ Lib \ tornado
Copying tornado \ template. py-> build \ Lib \ tornado
Copying tornado \ Testing. py-> build \ Lib \ tornado
Copying tornado \ WEB. py-> build \ Lib \ tornado
Copying tornado \ websocket. py-> build \ Lib \ tornado
Copying tornado \ win32_support.py-> build \ Lib \ tornado
Copying tornado \ wsgi. py-> build \ Lib \ tornado
Copying tornado \__ init _. py-> build \ Lib \ tornado

E: \ tornado11_path> Python setup. py install
Running install
Running build
Running build_py
Running install_lib
Creating c: \ python26 \ Lib \ Site-packages \ tornado
Copying build \ Lib \ tornado \ Auth. py-> C: \ python26 \ Lib \ Site-packages \ tornado
Copying build \ Lib \ tornado \ autoreload. py-> C: \ python26 \ Lib \ Site-packages \ tornado

Copying build \ Lib \ tornado \ database. py-> C: \ python26 \ Lib \ Site-packages \ tornado

......

Byte-compiling c: \ python26 \ Lib \ Site-packages \ tornado \ win32_support.py to win32_s
Upport. PyC
Byte-compiling c: \ python26 \ Lib \ Site-packages \ tornado \ wsgi. py to wsgi. PyC
Byte-compiling c: \ python26 \ Lib \ Site-packages \ tornado \__ init _. py to _ init _. PyC

Running install_egg_info
Writing C: \ python26 \ Lib \ Site-packages \ tornado-1.1-py2.6.egg-info

E: \ tornado11_path>

The installation is not complete yet, because tornado depends on pycurl, so we want to install pycurl-7.20.1.win32-py2.6 (http://wiki.woodpecker.org.cn/moin/pycurland http://pycurl.sourceforge.net/), the installation is simple, the Python path is automatically located and installed under python_path \ Lib \ Site-packages. This completes the installation.

You can use Python run in eclipse to directly run authdemo. py or helloworld. py, and then access http: // localhost: 8888. Check the result!
======================================
In addition, some plug-ins can be installed to see the http://wiki.eclipse.org, such as the installation of PHP plug-in PDT instructions http://wiki.eclipse.org/PDT/Installation
======================================

Configure pylint
1. Introduction to pylint

Pylint is mainly used to analyze your py code, find out the errors in the code, and give a prompt. It can also be used as a python module for some encoding style prompts. In short, it serves to make your code closer to the Code style described in pep 008 (http://www.python.org/dev/peps/pep-0008/) Title: Style Guide for Python code, so that your code is unified and more readable.

2. Download and install pylint

Pylint, logilab-astng, and logilab-common are installed in the same way as Django is installed. That is, direct use
Python setup. py install.

For all the packages used by pylint

Latest package for logilab-astng download: http://www.logilab.org/856/

Latest package for logilab-common download: http://www.logilab.org/848/

Optik package download: http://optik.sourceforge.net/

Pylint latest package download: http://www.logilab.org/project/pylint

Install pylint on Linux

1. in Linux, first install the python package (later than Version 2.2), and add the path of the python executable file to the environment variable $ path.

2. Download the packages of pylint, logilab-astng (version> = 0.14), and logilab-common (version> = 0.13). Usetar zxvf *.tar.gzDecompress these packages.

3. log on to the logilab-astng, logilab-common, and pylint folders in sequence, and run the commandPython setup.py install.

4. After the installation is complete, you can usepylint [options] module_or_packageTo call pylint.

Install pylint on Windows

1. Install the python package (later than Version 2.2), right-click my computer icon on the desktop, select Properties, advanced, and environment variables, and add the python installation path to $ path, as shown inC: \ python26 \.

2. Decompress all packages using the decompression tool.

3. Open the command line window and usecdLog on to the logilab-astng, logilab-common, and pylint folders, and run the following command:python setup.py install.

4. After the installation is complete, a scripts folder appears under the python installation path, which contains some bat scripts, such as pylint. bat.

5. to make calls to pylint. you do not need to enter the full path during bat. Create pylint In the python installation directory. bat redirection file, which is a plain text file pylint. bat, which contains pylint. the actual bat path, for example, C: \ python26 \ scripts \ pylint. BAT.

6. After the installation is complete, you can usepylint [options] module_or_packageTo call pylint.

Call of pylint
Pylint [Options] module_or_package

3. Configure pylint
(1) window-> preferences-> pydev-> pylint, select "use pylint? ", Enter the lint. py address, for example," C: \ python25 \ Lib \ Site-packages \ pylint \ lint. py"

(2) Add parameters in the last edit box to limit the output of pylint.

-- Persistent = n -- Comment = N

-- Disable-MSG = c0103, c0301, w0312, w0511, w0133, e1101

(3) Add the source file directory of the project to "project source Folders" in project-> properties-> pydev-pythonpath ".
(4) select project-> build automatically. When you save the changes, pylint automatically checks the code in the project. Otherwise, you must use Ctrl + B to manually build and trigger pylint.

PS: Use lint. py in command mode
Lint. py -- files-output = y -- Reports = y src/(add the directory of lint. py to Path First)
Two files starting with pylint _ are generated.

Other details: http://www.ibm.com/developerworks/cn/linux/l-cn-pylint/

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.