如何在 Jupyter Lab 的“将笔记本导出为..."菜单上获得“将笔记本导出到 Html_toc"选项? [英] How can I get the option 'Export Notebook to Html_toc' on the 'Export Notebook as...' menu in Jupyter Lab?
本文介绍了如何在 Jupyter Lab 的“将笔记本导出为..."菜单上获得“将笔记本导出到 Html_toc"选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
- 如何从 Jupyter 实验室的
Export Notebook As...
菜单启用所有jupyter nbconvert
导出选项?- 具体来说,我怎样才能在菜单上获得
Export Notebook to Html_toc
的选项?
- 具体来说,我怎样才能在菜单上获得
- 在全新安装 Anaconda 后,默认导出菜单为:
- 但是,如本期所示
解决方案
- 这个答案是在 Jupyter Lab 中启用完整菜单的迂回技巧
- 在这种情况下,我全新安装了 Anaconda,其中包括 Jupyter Lab 和 Jupyter Notebook.
- 进入 Jupyter 实验室后,只有最少的导出选项可用.
要启用 Html_toc 导出选项,请执行以下操作
- 转到 Jupyter Lab 中的扩展管理器并安装
@jupyterlab/toc
- 关闭 Jupyter 实验室并转到 Anaconda Prompt
- 根据
- 退出/退出 Jupyter Notebook
- 在 Anaconda 提示符下,转到
jupyter 实验室
- 现在所有
Export Notebook As...
选项都将在文件菜单中启用.- 包括,特别是
将笔记本导出到 Html_toc
- 包括,特别是
示例
- 以下是带有 Jupyter 实验室输出的目录的 HTML 笔记本示例.请参阅 DataCamp 笔记本.
- How can all of the
jupyter nbconvert
export options be enabled from theExport Notebook As...
menu in Jupyter lab?- Specifically, how can I get the option to
Export Notebook to Html_toc
on the menu?
- Specifically, how can I get the option to
- Following a clean installation of Anaconda, the default export menu is:
- However, as shown in this issue Add nbconvert export options to
File --> Export notebook as
#7612, there are additional options, which can be run from the console, but do not display in the menu. - The full menu would look like:
解决方案
- This answer is a roundabout hack for enabling the full menu in Jupyter Lab
- In this situation, I have a clean installation of Anaconda, which includes Jupyter Lab and Jupyter Notebook.
- Upon entering Jupyter Lab, only the minimal Export options are available.
To enable the Html_toc Export option, do the following
- Go to the Extension Manager in Jupyter Lab and install
@jupyterlab/toc
- Shut down Jupyter lab and go to the Anaconda Prompt
- Run
conda install jupyter_contrib_nbextensions
orconda install -c conda-forge jupyter_contrib_nbextensions
per Installing jupyter_contrib_nbextensions Guide.- This will install a number of extensions to
\Anaconda3\lib\site-packages\jupyter_contrib_nbextensions\nbextensions\
- There are
pip
install options in the guide, but I haven't tried this for a manual installation of Jupyter Lab and Jupyter Notebook
- This will install a number of extensions to
- Run
jupyter contrib nbextension install --user
- From the Anaconda Prompt, run
jupyter notebook
- During loading of the Jupyter Notebook environment, there where warnings as follows
[jupyter_nbextensions_configurator] nbextension '...' has duplicate listings
. - One location was
\Anaconda3\...
, as mentioned above, and the other was\Users\...\AppData\Roaming\jupyter\nbextensions\...
- This could be because I had a previous installation of Anaconda, but I resolved this issue by renaming
\Users\...\AppData\Roaming\jupyter\nbextensions\...
to\Users\...\AppData\Roaming\jupyter\nbextensions_old\...
- During loading of the Jupyter Notebook environment, there where warnings as follows
- Go to the
Nvextensions
tab, select the option forTable of Contents (2)
, andEnable
it. - Quit / Logout of Jupyter Notebook
- From the Anaconda prompt, go the
jupyter lab
- Now all of the
Export Notebook As...
options will be enabled in the file menu.- Including, and specifically
Export Notebook to Html_toc
- Including, and specifically
Examples
- Here are examples of HTML notebooks with a Table of Contents output from Jupyter Lab. See the DataCamp notebooks.
这篇关于如何在 Jupyter Lab 的“将笔记本导出为..."菜单上获得“将笔记本导出到 Html_toc"选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文