How to add automatically extension to Jupyter (ipython) notebook?

我们两清 提交于 2020-01-02 04:53:08

问题


I have installed extension 'calico-document-tools' and I can load it from within Jupyter notebook using:

%%javascript
IPython.load_extensions('calico-document-tools');

How can I load it automatically for each opened notebook?

I tried adding IPython.load_extensions('calico-document-tools'); or IPython.load_extensions('C:/Users/<username>/.ipython/nbextensions/calico-document-tools'); to C:\Users\<username>\.ipython\profile_default\static\custom\custom.js but it didn't work (extension should display a number of buttons on the toolbar).

I have only one profile, created with ipython profile create, Python 3.3, Windows 7. Thanks in advance.


回答1:


To install the extensions I followed the instructions in this notebook (not available anymore).

I adjusted them a little to be compatible with ipython4 (where the notebook server is called jupyter). This command installs the extension globally:

$ jupyter nbextension install https://github.com/Calysto/notebook-extensions/archive/master.zip

Then enable this extension:

$ jupyter nbextension enable calico-document-tools

When you now open or reload a notebook, it should load the extension

Updating the config to enable the extensions can also be done from inside the notebook:

%%javascript
IPython.notebook.config.update({
  "load_extensions": {"calico-spell-check":true,
                      "calico-document-tools":true,
                      "calico-cell-tools":true
                     }
})


来源:https://stackoverflow.com/questions/32046241/how-to-add-automatically-extension-to-jupyter-ipython-notebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!