Python PyLatex基本脚本赢得';无法运行,因为找不到脚本解释器

Python PyLatex基本脚本赢得';无法运行,因为找不到脚本解释器,python,Python,我正在努力学习PyLatex。我已经通过pip安装了它,并从中复制了基本代码,我发现了这个问题: C:\Conner\Scripts>pylatAttempt.py latexmk: The script interpreter could not be found. latexmk: Data: scriptInterpreter="perl.exe" Traceback (most recent call last): File "C:\Conner\Scripts\pylatAtte

我正在努力学习PyLatex。我已经通过pip安装了它,并从中复制了基本代码,我发现了这个问题:

C:\Conner\Scripts>pylatAttempt.py
latexmk: The script interpreter could not be found.
latexmk: Data: scriptInterpreter="perl.exe"
Traceback (most recent call last):
File "C:\Conner\Scripts\pylatAttempt.py", line 23, in <module>doc.generate_pdf()
File "C:\Python27\ArcGIS10.2\lib\site-packages\pylatex\document.py", line 193, in generate_pdf raise(e) 
subprocess.CalledProcessError: Command '[u'latexmk', u'--pdf', u'--interaction=nonstopmode', u'basic.tex']' returned non-zero exit status 1
C:\Conner\Scripts>pylatettempt.py
latexmk:找不到脚本解释器。
latexmk:Data:script解释器=“perl.exe”
回溯(最近一次呼叫最后一次):
文件“C:\Conner\Scripts\pylatettempt.py”,第23行,在doc.generate\u pdf()中
文件“C:\Python27\ArcGIS10.2\lib\site packages\pylatex\document.py”,第193行,在generate\u pdf中(e)
subprocess.CalledProcessError:Command'[u'latexmk',u'--pdf',u'--interaction=nonstopmode',u'basic.tex']'返回非零退出状态1

我已经下载了MiKTeX 2.9,还需要什么吗?这里出了什么问题?从文档中可以看出,您似乎只需要安装pylatex。

如果有人偶然发现了这一点,那么pylatex要想正常工作,您还必须安装Perl。一旦我从它下载了Perl,它就工作了。
确保Perl在路径中。

您可以将编译器更改为pdflatex,而不是latexmk,如果您安装了miktex和pdflatex,这将起作用。默认情况下,latexmk是编译器

doc.generate_pdf(clean_tex=False,compiler='pdfLaTeX')

我使用的是Python 2.7.14::Anaconda,Inc.,当我第一次尝试执行PyLaTeX的示例时,遇到了相同的问题

1) 在安装MikTeX之前执行复制的代码时

  (pylatex) G:\RishikeshAgrawani\ProjectsWin7\Python3\PyLaTeX\pylatex\01_basic>python 01
  Traceback (most recent call last):
    File "01_basic.py", line 24, in <module>
      doc.generate_pdf(clean_tex=False)
    File "C:\Anaconda2.5.0.1\lib\site-packages\pylatex\document.py", line 317, in genera
      u'or make sure you have latexmk or pdfLaTex installed.'
  pylatex.errors.CompilerError: No LaTex compiler was found
  Either specify a LaTex compiler or make sure you have latexmk or pdfLaTex installed.
3) 安装STARWBERRY PERL后

您可以看到上面的输出,它正在查找
perl.exe

所以我从下载了草莓perl并安装了它

现在我成功地运行了代码并获得了PDF

  (C:\Anaconda2.5.0.1) G:\RishikeshAgrawani\ProjectsWin7\Python3\PyLaTeX\pylatex\01_basic>python 01_basic.py

  (C:\Anaconda2.5.0.1) G:\RishikeshAgrawani\ProjectsWin7\Python3\PyLaTeX\pylatex\01_basic>

就这样。

Conner,我试图在同一天编辑我的评论,但我做不到!事实上,它确实奏效了!我需要进行一些配置,但正如您所建议的,Perl是必需的谢谢,它起作用了,但问题是我也能够使用
latexmk--PDF
命令创建PDF,所以默认值也应该起作用。如果有人偶然发现了这个解决方案,这确实对我有用!然而,我需要在perl安装之后重新启动我的机器,否则它将无法工作。另外,请确保perl在您的路径中(instalation自动为我完成了这项工作,但谁知道呢)。非常感谢您的更新。
  (C:\Anaconda2.5.0.1) G:\RishikeshAgrawani\ProjectsWin7\Python3\PyLaTeX\pylatex\01_basic>python 01_basic.py

  (C:\Anaconda2.5.0.1) G:\RishikeshAgrawani\ProjectsWin7\Python3\PyLaTeX\pylatex\01_basic>