根据以下命令:https://ipywidgets.readthedocs.io/en/stable/user_install.html,为了在旧版Jupyter Notebook上使用ipywidgets,必须安装适当的Jupyter Notebook扩展,如下所示:

pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension


此外,为了使用通过JupyterLab运行的Notebook中的ipywidget,一种方法是使用以下命令安装ipywidgets的JupyterLab扩展:

jupyter labextension install @jupyter-widgets/jupyterlab-manager


为什么会这样?我给人的印象是JupyterLab的笔记本只是Jupyter笔记本的旧版,它是JupyterLab的扩展包。我试图通读ipywidgets JupyterLab扩展的代码,但是我不确定发生了什么。

如果有人可以列出最重要的原因,那么为什么在通过JupyterLab运行Notebook时仅安装ipywidgets的Jupyter Notebook扩展是不够的,我将不胜感激。

提前致谢。

最佳答案

因此,我认为运行nbextension或labextension脚本的重点是添加一些新的CSS和Javascript库。大概Jupyterlab与Vanilla Jupyter的路径等是不同的;我认为没有理由期望与jupyter实验室共享nbextensions。

关于jupyter-notebook - ipywidgets的JupyterLab扩展的目的到底是什么?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48394690/

10-13 09:11