问题
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