Documentation

Installation

back to documentation index

Table of contents

Pygments requires at least Python 2.4 to work correctly. Just to clarify: there won't ever be support for Python versions below 2.4. However, there are no other dependencies.

Installing a released version

As a Python egg (via easy_install)

You can install the most recent Pygments version using easy_install:

sudo easy_install Pygments

This will install a Pygments egg in your Python installation's site-packages directory.

From the tarball release

  1. Download the most recent tarball from the download page
  2. Unpack the tarball
  3. sudo python setup.py install

Note that the last command will automatically download and install setuptools if you don't already have it installed. This requires a working internet connection.

This will install Pygments into your Python installation's site-packages directory.

Installing the development version

If you want to play around with the code

  1. Install Mercurial
  2. hg clone http://dev.pocoo.org/hg/pygments-main pygments
  3. cd pygments
  4. ln -s pygments /usr/lib/python2.X/site-packages
  5. ln -s pygmentize /usr/local/bin

As an alternative to steps 4 and 5 you can also do python setup.py develop which will install the package via setuptools in development mode.

Did you like the documentation? Do you have suggestions? Leave your comment here!

cchapin at gmail wrote on Feb. 1, 2010:

Like @tartley, I found that renaming to pygmentize.py was a good solution. Unlike @paul, starting the script that way didn't work for me. I'm @Vista.

paul@cravenfamily.com wrote on Jan. 20, 2010:

To get this to work on Windows, I explicitly had to start the python script:
C:\>python /Python26/Scripts/pygmentize -l python -f html -o test.html test.py

tartley@tartley.com wrote on Nov. 16, 2009:

@sgronblo
I also cannot use pygmentize on WindowsXP. I have to rename it 'pygmentize.py' or else add a .bat file that invokes it using 'python pygmentize %*'

Georg wrote on July 23, 2008:

That's true -- I fixed it in the trunk to ignore these errors now.

cakebread at gmail dot com wrote on July 22, 2008:

The tests will fail if you don't have the ttf-bitstream-vera font installed.

sgronblo@gmail.com wrote on May 10, 2007:

It seems that windows XP doesn't like running scripts without extensions from directories in PATH. I had to rename pygmentize to pygmentize.py to be able to run it from anywhere. I'm not sure if this is because of some setting on my system or if it's just windows being crappy.

 

Note: comments may be edited or deleted if they are of an offensive or inappropriate nature.