I would like to use PythonTex in Lyx on a Mac. I don't understand the intricacy of Lyx/Tex etc. I think I managed to install PythonLex by installing MacTex 2021 which also installed Tex Live Utility and if I use it to look at packages it also installed pythonlex.
I found this question StackExchange Question
Not sure how I enter the \xxxx statements into a document so tried
Document | Setting | Latex Preamble
And pasted info from article.
When I tried to display the PDF I found it did not like the first two lines with inputenc and fontenc
I would like to be able to enter matplotlib python into my document that display plots & charts, Please advise

pythontexin your$PATH? I am not familiar with LyX, but your error apell that you havent run pythontex on your file. If you want to use pythontex, you have to run latex compiler, then pythontex, then again latex compiler to get the results. – Tomáš Kruliš Aug 05 '21 at 07:38listing' with optionsfileext=lopytx' on inp ut line 20. \c@listing=\count288 \newfloat@ftype=\count289 Package newfloat Info: float type `listing'=8 on input line 20. (/usr/local/texlive/2021/texmf-dist/tex/context/base/mkii/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] – Keith Sloan Aug 05 '21 at 12:11pygmentspython package installed. Have you ever installedpygmentswithpip? – Tomáš Kruliš Aug 05 '21 at 12:12Lyx to display the PDF one invokes via Document | View PDF which just invokes pdflatex. So don't know how one would run the three commands under Lyx (GUI)
– Keith Sloan Aug 05 '21 at 12:29pythonbinary -- in your case that is python v. 2 actually. Look in pythontex docs, there should be info about how to set pythontex to usepython3and notpythonbinary. I personally uninstalled python2 and using only python3, but I dont know if that is OK on Mac. Other option would be to install pygments with python2, not python3 (but I dont know how to issue that with pip). – Tomáš Kruliš Aug 05 '21 at 17:30If I try from command line I getpythontex TestPythonTexA.pytexs1extension Not sure it will find the file
Would help if I could check the directory where the temp files are but mission impossible on mac.
– Keith Sloan Aug 05 '21 at 18:20