I am trying to install pythontex on my computer. I am using TeXstudio as my editor. I don't know if what I've done so far is correct, and how much more I need to do.

So far, I've downloaded these packages, per the manual's instructions: fancyvrb, fvextra, etoolbox, xstring, pgfplots, newfloat, currfile, color, pythontex. I have python 3.7 installed on my computer as well.

My editor allows me to run the pycode environment without raising an error. I used the following code as a test


    print("Hello World!")


Running the file outputted a pdf with the text "Test". The editor also produced these files:

  1. Test.aux
  2. Test.txt
  3. Test.pdf
  4. Test.pytxcode (pytxcode file)
  5. Test.synctex (WinRAR file)
  6. Test.tex

I know I am supposed to recompile my LaTex file Test after running some python code. I am not sure how to do that.

Can someone please advise.


1 Answer 1


You must specify your environment, and the version (s) of python installed on your machine. On my Debian box, I just compiled as usual, I open a terminal (tools menu) and type

pythontex --interpreter "python: python3" <filename>.tex

then recompile the tex file. To successfully compile, the python code must be error free, for example as in this file http://ix.io/3tph`

  • Thanks for the help! Do I need to specify any path variables? If I'm compiling the python code from the terminal, I would need to tell windows how to find pythontex right?
    – Harry
    Jul 19, 2021 at 15:25
  • Sorry,I can't really help since I'm not a Windows user. Probably you can google on "python windows configuration". I can do that but since I'm french, it should be french documentation. Once Python 3.x configured, you can test my command.
    – gigiair
    Jul 19, 2021 at 17:59
  • According to the pythontex documentation, the pythontex command on a Windows box should be "pythontex --interpreter" python:py -3 <file name> ". I can't check since I'm not a Windows user.
    – gigiair
    Oct 3, 2021 at 12:56

You must log in to answer this question.

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