我在努力学习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
我下载了MiKTeX 2.9,还需要什么吗?这里出什么问题了?从文档上看,你需要安装的似乎是幽门。
发布于 2016-04-11 23:00:17
如果有人无意中发现这一点,那么,要使PyLatex工作,您还必须安装Perl。一旦我从这里下载了Perl,它就起作用了。确保Perl在路径中。
发布于 2017-08-31 06:26:33
您可以将编译器更改为pdflatex,而不是latexmk,如果安装了miktex和pdflatex,就可以工作。默认情况下,latexmk是编译器。
doc.generate_pdf(clean_tex=False,compiler='pdfLaTeX')
发布于 2018-03-16 07:24:26
我正在使用Python2.7.14 ::Anaconda,Inc.和我第一次尝试在https://jeltef.github.io/PyLaTeX/latest/examples/basic.html上执行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.
2)安装MikTeX后
您可以看到上面的输出,我们可以通过安装LaTex compiler
MikTeX来安装它。
也可以阅读使用latexmk与MikTeX。
您可以在MikTeX上下载https://miktex.org/download。
(C:\Anaconda2.5.0.1) G:\RishikeshAgrawani\ProjectsWin7\Python3\PyLaTeX\pylatex\01_basic>python 01_basic.py
latexmk: The script engine could not be found.
latexmk: Data: scriptEngine="perl.exe"
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 269, in generate_pdf
stderr=subprocess.STDOUT)
File "C:\Anaconda2.5.0.1\lib\subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '[u'latexmk', u'--pdf', u'--interaction=nonstopmode', u'basic.tex']' returned non-zero exit
status 1
3)安装STARWBERRY 后
您可以在上面看到ouptput,它正在寻找perl.exe
。
所以我从http://strawberryperl.com/下载了Strawberry并安装了它。
现在我成功地运行了代码并获得了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>
就这样。
https://stackoverflow.com/questions/36560642
复制相似问题