2

I am using TeXworks on Mac osX 10.7.5 and I'm trying to compile some python code within my tex file but with limited success.

My tex file looks like:

\documentclass[12pt,A4]{article}
\usepackage{minted}
\begin{document}

\begin{minted}{python}

    def __init__(self, x, y): 
        self.x=x
        self.y=y

\end{minted}

\end{document}

When I run the tex file with the command:

pdflatex --shell-escape path.tex

I get the following error:

! Package minted Error: You must have `pygmentize' installed to use this packag
e.

The strange thing is, when I run the command, then type "quit". The PDF is produced as expected but how can I get it to produce the file without the error?

I have installed the latest version of minted and pygments. The terminal finds pygmentize:

ucbthsa-2:bin ucbthsa$ which pygmentize
/Library/Frameworks/Python.framework/Versions/Current/bin/pygmentize

I have had a look at another similar question but it has not helped

7
  • My system says /usr/local/bin/pygmentize; how did you install it?
    – egreg
    Feb 10, 2014 at 14:25
  • with easy_install
    – Harpalss
    Feb 10, 2014 at 14:28
  • What's the response of echo $PATH?
    – egreg
    Feb 10, 2014 at 14:31
  • /Users/ucbthsa/tcoffee/Version_9.03.r1318/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin:/usr/X11R6/bin
    – Harpalss
    Feb 10, 2014 at 14:40
  • On none of my machines I have Python as a framework; can you try moving /Library/... later in $PATH?
    – egreg
    Feb 10, 2014 at 14:41

1 Answer 1

3

Recently I had the same problem. The issue was that TeXworks has different PATH environment from your terminal. My solution was to create a symbolic link to pygmentize from /Library/Frameworks/Python.framework/Versions/3.5/bin/pygmentize to /usr/local/bin.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .