【问题标题】:Pypandoc error , RuntimeError: Pandoc died with exitcode "47" during conversion: b'pdflatex not foundPypandoc 错误,RuntimeError:Pandoc 在转换过程中因退出代码“47”而死:未找到 b'pdflatex
【发布时间】:2021-05-26 04:18:32
【问题描述】:

第一次在这里发帖,顺便说一下,我对这行特定的 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,执行产生相同的错误信息,我应该做什么或检查? 谢谢大家。

【问题讨论】:

  • 在 pypadoc 本身支持的名称中使用另一个 pdf 引擎会产生另一个错误:RuntimeError: Pandoc died with exitcode "1" during conversion: b'pdf-engine wkhtmltopdf is not compatible with output format latex
  • 我正在使用 ubuntu 18.04,谢谢

标签: python-3.x pandoc pypandoc


【解决方案1】:

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

sudo apt install texlive

【讨论】:

  • [ IT WORKS ] 按照您的建议安装 texlive 后,我运行了以下代码行 pandoc.convert_file(PATH_TO_ODT, 'pdf', format="odt", outputfile="<file_name>.pdf", extra_args=['--pdf-engine=pdflatex']) ,它终于可以工作了。 @mb21 非常感谢您,直截了当且有效。谢谢
【解决方案2】:

MB21:: Pandoc 实际上做了自己的转换——非常复杂的算法。我最近查看了主要作者(John MacFarlene)的演示文稿,pandoc 实际上将源代码转换为它自己的内部格式 AST。从 AST 格式,它能够转换为一长串文档格式。所以,pandoc 不只是调用 pdflatex。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-07-06
    • 1970-01-01
    • 1970-01-01
    • 2020-07-18
    • 2016-12-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多