-1

I created a program in Python (PyQT5 Gui) which compiles a LaTeX file to PDF through subprocess.Popen (with LaTeX pre-installed). Everything works fine if I create an application with pyinstaller on MacOS which runs within Terminal. However, if I create the app including the option --windowed/--noconsole, the command latex does not work anymore and the PDF cannot be created. I understand that I can locate latex via which latex and include the path in my Python file. Yet, it should work on any device, regardless where it is installed.

How can I fix this, so that it works on any MacOS, no matter where the latex executable is located (given it is pre-installed)? Thank you for your help!

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
chris
  • 131
  • 3
  • 1
    `latex` isn’t an environment variable, it’s just the name of the utility command. The relevant environment variable is `PATH`. Furthermore, what you’re describing is a [known issue](https://stackoverflow.com/q/135688/1968) with GUI applications on macOS, it’s not specific to your setup. I am not aware of a good solution (none of the linked ones works any longer). But note that if users launch your GUI application *via the command line* (i.e. via `open -a Appname`) the application will see the environment you configured inside your terminal shell. – Konrad Rudolph Aug 18 '23 at 07:25

0 Answers0