有时如果jupyter notebook比较长,需要显示各章节目录以方便查询,这是可以安装目录插件。这里使用的python版本为3.10,在安装jupyter notebook之后,用一下命令安装需要的插件:
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user
需要注意的是,对于3.10版本的python而言,默认安装的jupyter notebook版本比较高(7.1),需要将jupyter notebook的版本降到6.1:
pip install jupyter notebook==6.1.0
之后,重新启动jupyter notebook ,可以看到工具栏显示Nbextensions工具。在里面勾选"Table of contents"选项即可。