简体   繁体   中英

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

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.

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
                     }
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM