# Integrate Python code into Latex

Hi I would like to display a code with Minted. I have written the following

\documentclass[11pt]{article}
\usepackage{minted}
\usemintedstyle{fruity}
\begin{document}
\begin{minted}{python}
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.patches import Path, PathPatch
\end{minted}
\end{document}



However, I keep getting an error message that \end{minted} does not work. What have I done wrong?

The Error:

probably given a file that does not exist--otherwise, you may need
the outputdir package option, or may be using an incompatible build tool,
or may be using frozencache with a missing file.

See the minted package documentation for explanation.
Type  H <return>  for immediate help.
...

l.18 \end{minted}

This could be caused by using -output-directory or -aux-directory
without setting minted's outputdir, or by using a build tool that
changes paths in ways minted cannot detect,
or using frozencache with a missing file.


• Welcome to TSE. Please post a Minimal Working Example, instead of a code snippet. May 19 at 11:22
• Is this better? All the best May 19 at 11:27
• Yes. Thank you. May 19 at 11:31
• you follow tex.stackexchange.com/questions/146264/… May 19 at 11:37
• If you struggle to make minted work, have a look at listings`. The quality of the result is similar, and it doesn't require external tools. May 19 at 13:50