nbconvert:导出到另一个目录? [英] nbconvert: exporting to another directory?

查看:76
本文介绍了nbconvert:导出到另一个目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以将Jupyter笔记本导出到与笔记本本身不同的目录中?我正在使用它来构建笔记本的HTML版本,并且希望它们位于我的GitHub存储库中的docs/下(这是为了利用GH页面).

I'm wondering if it's possible to export a Jupyter notebook to a different directory than the same directory as the notebook itself? I'm using this to build HTML versions of the notebooks, and I'd like them to reside under docs/ in my GitHub repo (this is to take advantage of GH-pages).

推荐答案

NBConvert的--output-dir参数执行此操作: https://nbconvert.readthedocs.io/en/latest/install.html

NBConvert's --output-dir argument does this: https://nbconvert.readthedocs.io/en/latest/install.html

您可以从命令行或在Jupyter笔记本中使用它.

You can use it from the command line or from within a Jupyter notebook.

命令行:

jupyter nbconvert --output-dir='./docs' --to html my_notebook_to_be_converted.ipynb

在Jupyter Notebook单元中:

!jupyter nbconvert --output-dir='./docs' --to html my_notebook_to_be_converted.ipynb

请注意,由于默认输出格式为html,因此无需使用"--to html"将笔记本转换为html.我只是为了清楚起见而加入了该论点.

Note that you don't need to use "--to html" to convert a notebook to html because the default output format is html. I've included the argument solely for clarity.

这篇关于nbconvert:导出到另一个目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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