我想转换我的 ipython 笔记本来打印它们,或者只是以 html 格式发送它们。我注意到已经有一个工具可以做到这一点,NB转换 https://github.com/ipython/nbconvert。虽然我已经下载了它,但我不知道如何使用 nbconvert2.py 转换笔记本,因为 nbconvert 说它已被弃用。 nbconvert2.py 说我需要一个配置文件来转换笔记本,它是什么?有关于这个工具的文档吗?
如果您安装了 LaTeX,您可以直接从 Jupyter 笔记本下载 PDF 格式:File -> 下载为 -> 通过 LaTeX 生成 PDF (.pdf)。否则请按照以下两个步骤操作。
-
对于 HTML 输出,您现在应该使用 Jupyter 代替 IPython 并选择File -> 下载为 -> HTML (.html)或运行以下命令:
jupyter nbconvert --to html notebook.ipynb
这会将 Jupyter 文档文件 notebook.ipynb 转换为 html 输出格式。
Google Colaboratory 是 Google 的免费 Jupyter 笔记本环境,无需设置且完全在云端运行。如果您使用 Google Colab,命令是相同的,但 Google Colab 只允许您下载 .ipynb 或 .py 格式。
-
将 html 文件notebook.html 转换为名为notebook.pdf 的pdf 文件。在 Windows、macOS (brew install wkhtmltodf
) 或 Linux,安装wkhtml转pdf https://wkhtmltopdf.org/downloads.html。 wkhtmltopdf 是一个使用 WebKit 将 html 转换为 pdf 的命令行实用程序。您可以从链接的网页下载 wkhtmltopdf,或者在许多 Linux 发行版中可以在其存储库中找到它。
wkhtmltopdf notebook.html notebook.pdf
Original (now almost obsolete) revision: Convert the IPython notebook file to html.
ipython nbconvert --to html notebook.ipynb
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)