首页 > 解决方案 > Pypandoc 错误,RuntimeError:Pandoc 在转换过程中因退出代码“47”而死:未找到 b'pdflatex

问题描述

第一次在这里发帖,顺便说一句,我对这行特定的 Python (3.6) 代码有疑问:

file_converted = pandoc.convert_file(PATH_TO_ODT, 'pdf', format="odt", outputfile=file_name + ".pdf", extra_args=['--pdf-engine=pdflatex'])

当我执行脚本(将 .odt 文件转换为 .pdf 文件)时,遇到以下错误:

RuntimeError: Pandoc died with exitcode "47" during conversion: b'pdflatex not found. Please select a different --pdf-engine or install pdflatex

基本上我知道我需要“pdflatex”,但是在我通过 pip 使用命令安装它之后

pip install pdflatex,执行产生相同的错误消息,我应该做什么或检查?谢谢你们。

标签: python-3.xpandocpypandoc

解决方案


对于 pypandoc,它只是调用pandoc命令行程序,而后者又调用pdflatex,您可能应该在系统范围内安装 LaTeX。在 Ubuntu 上,即:

sudo apt install texlive

推荐阅读