Jupyter Notebook导出PDF时报错“nbconvert failed: xelatex not found on PATH……”的解决办法

对于没有经过特别配置的Jupyter Notebook,我们在导出文件为PDF时经常会出现以下报错:

nbconvert failed: xelatex not found on PATH, if you have not installed
xelatex you may need to do so. Find further instructions at
https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex.

报错原因:没有安装xelatex

(注意:有些情况下,除过要安装"xelatex"外,还需要安装“pandoc", 不过Anaconda2-5.0.1以上版本已经默认安装了pandoc,这时就只需要安装"xelatex")

解决办法:

第一步: 下载并安装“Miktex”软件

下载地址:https://miktex.org/download
Jupyter Notebook导出PDF时报错“nbconvert failed: xelatex not found on PATH……”的解决办法_第1张图片

第二步:把上一步安装的Miktex的安装路径添加到环境变量中

Miktex的安装路径: C:\Program Files\MiKTeX\miktex\bin\x64
Jupyter Notebook导出PDF时报错“nbconvert failed: xelatex not found on PATH……”的解决办法_第2张图片

第三步:重启Jupyter Notebook, 打开任意一个“ipynb”文件,点击“Download as” - “PDF via LaTeX(.pdf) ”

Jupyter Notebook导出PDF时报错“nbconvert failed: xelatex not found on PATH……”的解决办法_第3张图片

第四步:接下来会弹出N个(确实是N个)下面的菜单提示安装各个包,每次点击“Install”安装即可,直至不再弹出这个菜单

Jupyter Notebook导出PDF时报错“nbconvert failed: xelatex not found on PATH……”的解决办法_第4张图片

第五步:再次点击Download as” - “PDF via LaTeX(.pdf) ” ,此时便会在当前浏览器的下载项中导出PDF文件。

你可能感兴趣的:(python)