我正在尝试使用。除了使用 pylatex )。
Pylatex
和 pdflatex
模块都需要调用 subprocess 模块,如下所示:
fp = subprocess.run(args, input=self.latex, env=env, timeout=15, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
where args = ['pdflatex','-output-directory =/uders/udse/desktop','-sintaction mode = batchmode',' - - jobname = test']
但是,这在捆绑的应用程序中不起作用,因为它遇到了以下错误,我将登录到文件:
[Errno 2] No such file or directory: 'pdflatex'
显然, pdflatex
discarboble均未执行包含/发现在捆绑包中。在终端输出中运行哪个pdflatex
以下目录:/library/tex/texbin/pdflatex
,因此我尝试使用以下pyinstaller命令添加路径:
pyinstaller --noconsole --onefile --path "/Library/TeX/texbin" main.py
但是应用程序应用程序。仍然找不到 pdflatex
在运行时可执行的,而终端可执行文件无问题。我已经用尽了所有类似的帖子在线上,并且无法尝试尝试,所以我希望有人可以指导我采取解决方案。
相关信息:
- MACOS版本:10.13.6 High Sierra
- Python:3.8
- Pyinstaller:5.1
I am attempting to create a macOS standalone app from a PyQt5
GUI using PyInstaller. All works apart from automatically generating a PDF from a TEX file using the pdflatex module (in conjunction with Pylatex).
Both the pylatex
and pdflatex
modules require calling the subprocess module, which is done as following:
fp = subprocess.run(args, input=self.latex, env=env, timeout=15, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Where args=['pdflatex', '-output-directory=/Users/Desktop', '-interaction-mode=batchmode', '-jobname=test']
This however does not work within the bundled app as it is crashing with the following error which I am logging to a file:
[Errno 2] No such file or directory: 'pdflatex'
Evidently, the pdflatex
executable isn't being included/ found in the bundle. Running which pdflatex
in the terminal outputs the following directory: /Library/TeX/texbin/pdflatex
So I have tried to add the path with the following PyInstaller command:
pyinstaller --noconsole --onefile --path "/Library/TeX/texbin" main.py
But the app still cannot find the pdflatex
executable at runtime, whereas the terminal executable works without issues. I have exhausted all similar posts online and ran out of things to try so I was hoping someone might guide me to the solution.
Related info:
- macOS version: 10.13.6 High Sierra
- Python: 3.8
- PyInstaller: 5.1
发布评论
评论(1)
我遇到了同样的问题,我只是通过编辑Pyinstaller生成的运行时环境来解决它。在我的情况下,找不到
npm
命令,在运行之后,终端中的哪个NPM
可以看到NPM位于/usr/usr/usr/local/bin ,Pyinstaller在MacOS上未包含的路径。
因此,我的解决方案是在应用启动下运行此问题:
I had the same problem and I just solved it by editing the runtime environment generated by PyInstaller. In my case the
npm
command was not found and after runningwhich npm
in terminal I could see that npm was located in/usr/local/bin
, path that is not included by PyInstaller on macOS.So my solution is to run this at app startup: