文章目录

  • 安装
  • 常用插件
  • Table of Contents
  • Codefolding
  • ExcecuteTime
  • Spellchecker
  • Notify
  • Variable Inspector
  • Hinterland
  • Autopep8
  • Reference


安装

打开cmd命令行,依次输入

pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
pip install jupyter_nbextensions_configurator

重新启动Jupyter Notebook后,就会发现已经有Nbextensions扩展页面了

jupyter notebook axes代码 jupyter notebook编程_重启

常用插件

需要哪些插件,直接勾选就可以了。注意要取消disable configuration for nbextensions...前面的勾勾

jupyter notebook axes代码 jupyter notebook编程_拼写检查_02

Table of Contents

这个插件会根据Markdown的标题层次形成一个目录,可以通过点击目录,直接定位到对应代码位置,在长代码文件中能起到导航的作用。强烈推荐。

Codefolding

代码折叠,可以让代码变得更加干净整洁

jupyter notebook axes代码 jupyter notebook编程_重启_03

jupyter notebook axes代码 jupyter notebook编程_重启_04

ExcecuteTime

查看代码执行时间,这个插件会代码模块最后计算该模块的计算时间和运行结束时间,美观实用。

jupyter notebook axes代码 jupyter notebook编程_常用插件_05

Spellchecker

对 markdown 单元中的内容进行拼写检查,写说明文档时,防止单词拼写错误的糗事发生。

jupyter notebook axes代码 jupyter notebook编程_拼写检查_06


jupyter notebook axes代码 jupyter notebook编程_重启_07

Notify

这个插件功能在你需要长时间跑一个代码时可启用,无需在页面等待,程序运行完成后,会弹出通知。

jupyter notebook axes代码 jupyter notebook编程_常用插件_08

Variable Inspector

这是一个查看变量的插件,类似于 Matlab 和 R studio 的工作空间,可以查看变量名、类型,大小,形状和值。其中变量的 shape (形状)这个参数在进行矩阵运算时,十分实用,并且这个窗口还可以调节大小,排序等功能,十分推荐。

jupyter notebook axes代码 jupyter notebook编程_拼写检查_09

Hinterland

勾选此插件为代码单元格中的每次按键启用“代码自动补全”菜单,而不是仅用Tab键时启用,有种在pycharm中写代码的感觉了。

jupyter notebook axes代码 jupyter notebook编程_重启_10

Autopep8

这是一个将代码按照PEP8进行格式化的插件,前提是需要通过pip install autopep8安装autopep8,安装完之后需要重启jupyter notebook服务才能生效。同样在Nbextention选项卡中勾选Autopep8,在工具栏中会多一个“锤子”一样的按钮,可以帮助我们排版代码,使其符合pep8标准。

jupyter notebook axes代码 jupyter notebook编程_常用插件_11


jupyter notebook axes代码 jupyter notebook编程_拼写检查_12


jupyter notebook axes代码 jupyter notebook编程_重启_13


jupyter notebook axes代码 jupyter notebook编程_重启_14