我尝试在安装了texlive-*的Arch上运行以下Python代码:
from latex import build_pdf
# Read the template from the file...
min_latex = (r"\documentclass{article}"
r"\begin{document}"
r"Hello, world!"
r"\end{document}")
# Compile it...
pdf = build_pdf(min_latex)
# Save the generated .pdf to a new file...
path_to_save = 'new_file.pdf'
pdf.save_to(path_to_save)它返回一个异常:latex.exc.LatexBuildError: None
我既不能构建任何胶乳文件,也不能构建字符串,也不能使用任何构造器。我尝试过手动使用LatexMkBuilder() (从AUR安装了latex-mk之后)和PdfLatexBuilder .build_pdf(),但是没有结果。
然而,它在(大约一个月前)之前起了作用。看看到底发生了什么。有什么建议吗?
更新1:它开始在subprocess.check_call() of build_pdf()中下降。
更新2:在latex中,创建临时文件似乎是个问题,这导致了FileNotFoundError for subprocess.check_call()。
发布于 2022-08-31 13:52:28
在PowerShell中运行我的脚本时,我也遇到了同样的错误(但由于某种原因,在git-bash中没有)。我发现将构建器从latexmk更改为pdflatex很有帮助;也就是说,在本例中,让:
pdf = build_pdf(min_latex, builder='pdflatex')https://stackoverflow.com/questions/51211279
复制相似问题