IPython Notebook-无法导出为PDF [英] IPython notebook - unable to export to pdf

查看:192
本文介绍了IPython Notebook-无法导出为PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将IPython笔记本导出为pdf,但是我不知道该怎么做.我搜索了stackoverflow,并且已经阅读了有关nbconvert的信息,但是在哪里键入该命令?在笔记本上?在cmd提示符下? 如果有人可以一步一步告诉我,该怎么办?我正在使用Python 3.3和IPython 1.1.0. 预先谢谢你:)

I'm trying to export my IPython notebook to pdf, but somehow I can't figure out how to do that. I searched through stackoverflow and already read about nbconvert, but where do I type that command? In the notebook? In the cmd prompt? If someone can tell me, step by step, what to do? I'm using Python 3.3 and IPython 1.1.0. Thank you in advance :)

推荐答案

  1. 对于HTML输出,您现在应该使用Jupyter代替IPython,然后选择文件-> 下载为-> HTML(.html) 或运行以下命令:

  1. For HTML output, you should now use Jupyter in place of IPython and select File -> Download as -> HTML (.html) or run the following command:

jupyter nbconvert --to html notebook.ipynb  

这会将Jupyter文档文件notebook.ipynb转换为html输出格式.

This will convert the Jupyter document file notebook.ipynb into the html output format.

Google Colaboratory是Google的免费Jupyter笔记本环境,无需进行设置即可完全在云中运行.如果您使用的是Google Colab,则命令是相同的,但是Google Colab仅允许您下载.ipynb或.py格式.

Google Colaboratory is Google's free Jupyter notebook environment that requires no setup and runs entirely in the cloud. If you are using Google Colab the commands are the same, but Google Colab only lets you download .ipynb or .py formats.

将html文件notebook.html转换为名为notebook.pdf的pdf文件.在Windows,Mac或Linux中,安装 wkhtmltopdf . wkhtmltopdf是一个命令行实用程序,可使用WebKit将html转换为pdf.您可以从链接的网页下载wkhtmltopdf,或者在许多Linux发行版中都可以在其资源库中找到它.

Convert the html file notebook.html into a pdf file called notebook.pdf. In Windows, Mac or Linux, install wkhtmltopdf. wkhtmltopdf is a command line utility to convert html to pdf using WebKit. You can download wkhtmltopdf from the linked webpage, or in many Linux distros it can be found in their repositories.

wkhtmltopdf notebook.html notebook.pdf   


原始(现在几乎已经过时)修订:


Original (now almost obsolete) revision:

  1. 将IPython笔记本文件转换为html.

  1. Convert the IPython notebook file to html.

ipython nbconvert --to html notebook.ipynb  

这会将IPython文档文件notebook.ipynb转换为html输出格式.

This will convert the IPython document file notebook.ipynb into the html output format.

将html文件notebook.html转换为名为notebook.pdf的pdf文件.在Windows,Mac或Linux中,安装 wkhtmltopdf . wkhtmltopdf是一个命令行实用程序,可使用WebKit将html转换为pdf.您可以从链接的网页下载wkhtmltopdf,或者在许多Linux发行版中都可以在其资源库中找到它.

Convert the html file notebook.html into a pdf file called notebook.pdf. In Windows, Mac or Linux, install wkhtmltopdf. wkhtmltopdf is a command line utility to convert html to pdf using WebKit. You can download wkhtmltopdf from the linked webpage, or in many Linux distros it can be found in their repositories.

wkhtmltopdf notebook.html notebook.pdf  

这篇关于IPython Notebook-无法导出为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆