16 January 2006 ~ 6 Comments

Installing PyLint on Windows

Based on the Komodo/PyLint discussion of the last few days, I decided it was a good night to try to get everything installed and working on my Windows box.

Here’s what I had to do to get it all working…


1. Add Python directories to your path
Right click on My Computer on your desktop and go to the Advanced tab:

Advanced tab

Click the Environment Variables button, and under System Variables select Path:

Advanced tab

Hit the Edit button and add C:\Python24;C:\Python24\Scripts to the path list:

Advanced tab

2. Download packages

Download the following packages from Logilab:

  • Logilab ASTNG: Base representation of python source code for projects such as pychecker, pyreverse, pylint.
  • Logilab Common Libraries: Contains several modules providing low level functionnalities shared among some python projects developped by logilab.
  • PyLint: Source code checker.

After downloading, unpack them into their respective directories. I just used 7-Zip to extract them to folders on my desktop.

3. Install packages

Assuming you set your path correctly (see Step 1), you should be able to run Python from the Windows command line.

To install each package, open a cmd.exe shell (i.e. Start, Run, cmd.exe) and cd into each directory that you created in Step 2. From there run the following command:

python setup.py install

You should see a bunch of lines flash by as the files are copied over to your Python directory. Repeat for ASTNG, Common, and PyLint.

After you are done, if pylint.bat wasn’t copied to C:\Python24\Scripts, copy it over there manually.

4. Create pylint.bat redirect file

Create a file called pylint (no extension) in C:\Python24 that contains the following text:

C:\Python24\Scripts\pylint.bat

5. Add to Komodo toolbox (optional)

That should be it! You are ready to use PyLint to check your scripts. If you use Komodo as your IDE, you can now follow Mateusz’s instructions for running PyLint from Komodo.

Note: My instructions assume you are using Windows 2K/XP and Python 2.4. Obviously some things will change if you are using a different configuration.

6 Responses to “Installing PyLint on Windows”

  1. Brandon 22 April 2008 at 2:36 pm Permalink

    If you are using eclipse and pydev then it just needs to know where lint.py is so you do not need to do steps 4 and 5. If you go to Window -> Preferences and drill down to Pydev -> Pylint check the “Use Pylint” box and then click on “Broswse” and go to %PYTHON_ROOT%\Lib\site-packages\pylint and select lint.py and you should be good to go. You will get some good highlighting of problems where pylint sees them.

  2. Leszek Bajorski 11 February 2009 at 5:04 am Permalink

    Hi,

    I’m using eclipse (pydev+pylint) for python development. I would like to configure pylint to accept lines shorter then 100 chars and try to change
    pylintrc for it, unfortunately it does not work.

    What is the correct location of pylintrc in Windows?
    Is any configuration on eclipse necessary?

    Could you help me?

  3. Yassen 7 March 2009 at 7:45 am Permalink

    Thanks a lot for this tip; works fine also for python 2.5!

  4. Yassen 8 March 2009 at 10:44 am Permalink

    UPDATE: unfortunately, pylint installs fine but DOES NOT WORK on Windows, cpython 2.5. Looks like the logilab guys discriminate the hated platform as their code does not do any effort to recognize the platform and adapt accordingly :(

  5. NicolasChauvat 23 March 2009 at 12:15 pm Permalink

    If you found a bug in pylint, the right place to report it is http://lists.logilab.org/mailman/listinfo/python-projects

    Complaining in a comment of a blog will get you nowhere.

  6. Adam 29 April 2009 at 11:09 pm Permalink

    At 1st I had the same problem as Yassen (“pylint installs fine but DOES NOT WORK”):
    I had installed the 3 packages {ASTNG, common, pylint } individually using “python setup.py install” for each. Pylint was NOT functioning properly, a phenomenon I could test directly from the Python command-line interpreter:
    The line “from pylint import lint” issued an error.

    So I got rid of these packages and did “easy_install pylint” and everything was fine after that.
    (I installed the setuptools package and scripts (setuptools-0.6c9.win32-py2.5.exe) to get easy_install to work on my PC).


Leave a Reply