nbconvert: exporting to another directory?

一个人想着一个人 提交于 2021-01-02 06:47:30

问题


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).


回答1:


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

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

Command line:

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

From within a Jupyter Notebook cell:

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

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.



来源:https://stackoverflow.com/questions/44099409/nbconvert-exporting-to-another-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!