插件的具体用法在github中可以详细查看
github地址:https://github.com/ipython-contrib/jupyter_contrib_nbextensions
以下操作都在虚拟环境中进行,确保你已经创建了一个你所需要的python虚拟环境。
一、确保notebook版本大于6.0,运行一下代码查看:
conda list notebook
# 或者
pip show notebook
二、若小于版本小于6.0,先卸载原来的
conda uninstall notebook
# 或者
pip uninstall notebook
三、然后安装,这里安装了6.1版本的,大于6.0都可以
conda install notebook==6.1
# 或
pip install notebook==6.1
四、安装nbextensions插件,如果安装Anaconda的时候没点安装环境变量,这一步可能会报错说ERROR: Failed building wheel for jupyter-nbextensions-configurator,解决办法看下面,没有则不用管。
pip install jupyter_contrib_nbextensions
# 或
conda install -c conda-forge jupyter_contrib_nbextensions
ERROR: Failed building wheel for jupyter-nbextensions-configurator解决办法:
进入https://www.cnpython.com/pypi/jupyter-contrib-nbextensions/download下载缺少的Wheel,
下载第一个,如图:
然后通过一下命令安装:(安装包路径是你的下载保存路径)
pip install 安装包文件路径\jupyter_contrib_nbextensions-0.5.1-py2.py3-none-any.whl
五、安装JavaScript和css文件,此步骤将nbextensions的javascript和css文件复制到jupyter中服务器的搜索目录。
jupyter contrib nbextension install --user
六、运行jupter notebook进行设置,勾选Table of Contents(2)
搞定!目录详细的用法看这篇文章: