How to install syntax highlight package minted on Windows 7?

Python 3.4 and newer come with the package manager pip already included:
http://docs.python.org/3.4/whatsnew/3.4.html

Setting up minted+Pygments has therefore become very easy:

  1. Install the latest Python 3.x (PATH can be set during installation).
  2. From a normal command prompt, run python -m pip install -U pygments. This will create a pygmentize.exe in the Pythons Scripts directory.
  3. You are done. Using \usepackage{minted} in .tex files should now work.

Of course, pdfLaTeX (or whatever engine/format you use) still has to be called with the -shell-escape option.


On my Windows 7 system, the following got things working:

  • Download and install Python 2.7.2
  • Download and install distribute
  • Add C:\Python27\Scripts to the Windows path (I also added C:\Python27 for general convenience)
  • At the Command Prompt, do easy_install Pygmentize

That is it install-wise: the current Pygmentize does come with a Windows executable. You can test this by doing pygmentize -V at the Command Prompt.

What I then found is that the test that minted uses for Pygmentize on Windows is broken. So I used the lines

\newcommand\TestAppExists[3]{#2}
\usepackage{minted}

to bypass the test (this basically forces the TRUE branch). The example document then compiles fine.


The problem might be due to issues with setuptools (for example with UAC).

Here is an installation procedure which is working for me:

  1. Install Python 2.7

  2. Install distribute (replacement for setuptools because it is buggy and no more maintained)

  3. Add C:\Python27\Scripts to your PATH

  4. Install pip: easy_install pip

  5. Install pygments: pip install pygments

These steps create a pygmentize.exe, so there is no need to create the batch file.