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:



    def __init__(self, x, y): 



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

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

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

  • My system says /usr/local/bin/pygmentize; how did you install it? – egreg Feb 10 '14 at 14:25
  • with easy_install – Harpalss Feb 10 '14 at 14:28
  • What's the response of echo $PATH? – egreg Feb 10 '14 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 '14 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 '14 at 14:41

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.