jeffsui / jeffsui.github.io

pinghailinfeng's blog main website
http://jeffsui.github.io
7 stars 5 forks source link

jupyter notebook 之插件安装 #71

Open jeffsui opened 4 years ago

jeffsui commented 4 years ago

通过pip安装

pip install jupyter_contrib_nbextensions

在jupyter中安装插件

jupyter contrib nbextension install --user --skip-running-check

再次启动 jupyter notebook

发现多了一个Nbextension选项

有用的插件推荐

  1. 代码导航功能 Table of Contents
  2. 变量检查器 Variable Inspector
  3. 显示单元格运行的时间和长度 Excute time
  4. 折叠/放下标题 Collapsible Headings
  5. 折叠代码 Codefolding
  6. 隐藏代码 hide input 隐藏选定代码 hide input all 隐藏所有代码
  7. 代码自动补全 Hinterland
  8. 通知 Notify Jupyter Notebook

    首先你要勾选Notify扩展,其次再点击按钮正式启动。你选择的时间是Jupyter Notebook运行的最短时间,到点后它会向你发送通知

  9. 隐藏活动状态栏 zenmode
  10. tqdm_notebook 为循环代码显示执行进度条
    # 先安装 tqdm :pip install tqdm
    # 使用时导入:from tqdm import tqdm_notebook
  11. 脚本自动保存 AutoSaveTime
jeffsui commented 4 years ago

安装步骤: 如果你已经安装了,先执行卸载命令:

pip uninstall jupyter_contrib_nbextensions pip uninstall jupyter_nbextensions_configurator

打开Anaconda Prompt窗口,执行第一个命令,用于安装nbextensions: pip install jupyter_contrib_nbextensions

再执行第二个命令,用于安装 javascript and css files jupyter contrib nbextension install --user

最后执行,用于安装configurator pip install jupyter_nbextensions_configurator

然后重新启动Jupyter Notebook后,就会发现已经有Nbextensions标签了。

jeffsui commented 4 years ago

补充 tqdm使用

from tqdm import tqdm, tqdm_notebook
from time import sleep
for i in tqdm_notebook(range(4), desc='1st loop'):
    for j in tqdm_notebook(range(10), desc='2nd loop', leave=False):
        for k in tqdm_notebook(range(20), desc='3rd', leave=False):
            sleep(0.01)