在Jupyter中将ipynb转换为pdf [英] Convert ipynb to pdf in Jupyter
问题描述
我是ipython Notebook的新手,我想将ipynb转换为pdf.但是,当我尝试通过LaTex下载为PDF时,出现以下错误.
I am new to ipython notebook, and I would like to convert my ipynb to pdf. But I get the following error when I try to Download as PDF via LaTex.
nbconvert failed: pdflatex not found on PATH
在任何地方都没有关于如何将pdflatex添加到我的PATH的文档.我用窗户.谢谢!
There is no documentation anywhere how to add pdflatex to my PATH. I use windows. Thank you!
推荐答案
Thomas K 在注释,您需要安装Latex,然后将包含pdflatex.exe
文件的目录的路径添加到系统的PATH
变量中.
As said by Thomas K in the comments, you need to have Latex installed, and after add the path to the directory containing pdflatex.exe
file to the PATH
variable of your system.
我一直在寻找轻量级的发行版,并尝试安装 TeXworks ,但是我没有找到任何pdflatex.exe
文件.
因此,我尝试了 TeX Live ,该方法在目标安装目录下创建pdflatex.exe
文件的效果很好.此路径应类似于C:\...\texlive\2016\bin\win32
.
最后,您只需将此路径添加到系统的PATH
环境变量中即可(您可以使用 Thomas K共享的链接).
I have looked for a lightweight distribution and tried installing TeXworks, but I didn't find any pdflatex.exe
file.
So I have tried TeX Live, which worked fine creating the pdflatex.exe
file under the target installation directory. This path should be like C:\...\texlive\2016\bin\win32
.
Finally, you should just add this path to the PATH
environment variable of your system (you can use the link shared by Thomas K).
如此处所述,您需要退出jupyter笔记本并进行任何路径更改后,请打开一个新的命令提示符,以使jupyter在PATH
中找到新添加的项目.
As said here, you need to quit jupyter notebook and open a new command prompt after making any path changes, in order for jupyter to find the newly added item to the PATH
.
然后,在Jupyter中,您可以通过运行以下命令检查环境变量(请参阅此
Then, in Jupyter, you can check your environment variables by running the following (refer to this link for details):
import os
os.environ['PATH'].split(';')
,然后检查其中是否包含pdflatex.exe
文件的路径.
and check if it contains the path to pdflatex.exe
file.
如果由于缺少文件/软件包而在将笔记本导出为pdf时遇到麻烦(发生在我身上),请参阅此
If you get some trouble when exporting your notebook to pdf due to missing files/packages (this happened to me), refer to this link to search and install them under TeX Live.
这篇关于在Jupyter中将ipynb转换为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!