How to add automatically extension to Jupyter (ipy

2019-04-30 04:53发布

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条回答
淡お忘
2楼-- · 2019-04-30 04:59

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
                     }
})
查看更多
登录 后发表回答