# Using PythonTex in Lyx2.2.2 under Windows 10

I have this simple ERT code in LyX:

Say hello Python

\begin{pycode}
print ('Hello, \\LaTeX')
\end{pycode}


The output (I click on the pair of eyes) is simply:

Say hello Python

It seems that the Python code is not being executed.

Has anyone encountered this before, and if so, is there a neat solution?

• By clicking on the pair of eyes you're running pdflatex, not pythontex. You have to set up the default output format. Check what's in Tools>Preferences and Document>Settings. Jul 15 '17 at 12:04
• I thought that the package pythontex would run the Python code in the background and once that is completed, then the pdflatex would output to a pdf file. I am not getting any errors, it's just that the Python code is not being seen. Jul 17 '17 at 9:08
• No, that is incorrect. As described in the manual, you need to run pythontex filename in between runs of pdflatex filename. See if tex.stackexchange.com/questions/114285/… helps you setting up LyX to run pythontex as well. Aug 4 '17 at 20:43