jupyter notebook中ipywidgets插件不显示
程序员文章站
2022-02-02 09:46:53
...
【环境】mac
【解决】
1,重新安装ipywidgets, widgetsnbextension 。在终端中执行:
pip install --upgrade --force-reinstall ipywidgets
# for windows cmd: pip install --upgrade --force-reinstall ipywidgets --user
pip install --upgrade --force-reinstall widgetsnbextension
# for windows cmd: pip install --upgrade --force-reinstall widgetsnbextension --user
2,安装jupyter-js-widgets/extension,在终端中执行:
jupyter nbextension install --py widgetsnbextension
# for windows cmd: jupyter nbextension install --py widgetsnbextension --user
# 输出:
'''
Installing C:\Users\Lenovo\AppData\Roaming\Python\Python36\site-packages\widgetsnbextension\static -> jupyter-js-widgets
Making directory: C:\Users\Lenovo\AppData\Roaming\jupyter\nbextensions\jupyter-js-widgets\
Copying: C:\Users\Lenovo\AppData\Roaming\Python\Python36\site-packages\widgetsnbextension\static\extension.js -> C:\Users\Lenovo\AppData\Roaming\jupyter\nbextensions\jupyter-js-widgets\extension.js
Copying: C:\Users\Lenovo\AppData\Roaming\Python\Python36\site-packages\widgetsnbextension\static\extension.js.map -> C:\Users\Lenovo\AppData\Roaming\jupyter\nbextensions\jupyter-js-widgets\extension.js.map
- Validating: ok
To initialize this nbextension in the browser every time the notebook (or other app) loads:
jupyter nbextension enable widgetsnbextension --user --py
'''
3,在jupyter notebook中开启widgetsnbextension。在终端中执行:
jupyter nbextension enable --py widgetsnbextension --sys-prefix
# for windows cmd: jupyter nbextension enable --py widgetsnbextension --sys-prefix --user
# 输出如下:
# Enabling notebook extension jupyter-js-widgets/extension...
# - Validating: OK
4,打开jupyter notebook。在终端中执行:
jupyter notebook
5,然后可以运行有widgets内容的代码。
【致谢】
landryshuai @ https://github.com/jupyter-widgets/ipywidgets/issues/1146
https://*.com/questions/47396512/jupyter-widget-does-not-appear-in-notebook
推荐阅读
-
jupyter notebook中图片显示不出来的解决
-
Jupyter notebook中如何显示pyplot图表
-
jupyter notebook中图片显示不出来的解决
-
在Jupyter Notebook 中显示动画
-
ipython jupyter notebook中显示图像和数学公式
-
Jupyter Notebook中显示图像和数学公式
-
matplotlib——在 Jupyter Notebook中绘制图像时只显示变量信息不显示图片
-
jupyter notebook中ipywidgets插件不显示
-
pyecharts图形在Jupyter-notebook中不显示问题
-
Jupyter-notebook或者HTML中不显示pyecharts图形