Jupyter 小部件未出现在笔记本中 [英] Jupyter widget does not appear in notebook

查看:52
本文介绍了Jupyter 小部件未出现在笔记本中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个 jupyter 笔记本,但没有出现 jupyter 小部件.相反,我收到以下消息:

无法显示 Button 类型的 Jupyter 小部件.如果您在 Jupyter Notebook 或 JupyterLab Notebook 中阅读此消息,则可能意味着 JavaScript 小部件仍在加载.如果此消息仍然存在,则可能意味着小部件 JavaScript 库未安装或未启用.有关设置说明,请参阅 Jupyter 小部件文档.如果您在另一个前端(例如,GitHub 或 NBViewer 上的静态渲染)阅读此消息,则可能意味着您的前端当前不支持小部件.

我有以下版本:

widgetsnbextension (3.0.8)ipywidgets (7.0.5)

我用这个命令安装了小部件:

pip install ipywidgetsjupyter nbextension 启用 --py widgetsnbextension

我的代码也是:

将 ipywidgets 导入为小部件从 IPython.display 导入显示button = widgets.Button(description='Hello')显示(按钮)

解决方案

我有相同的版本和代码工作形式.在启动 jupyter notebook 之前.你试试执行吗?:

jupyter nbextension enable --py widgetsnbextension --sys-prefix

输出 ==>

启用笔记本扩展 jupyter-js-widgets/extension...- 验证:好的

**

I'm running a jupyter notebook but the jupyter widgets does not appear. Instead I receive the folllowing message:

Failed to display Jupyter Widget of type Button.
If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean that the widgets JavaScript is still loading. If this message persists, it likely means that the widgets JavaScript library is either not installed or not enabled. See the Jupyter Widgets Documentation for setup instructions.
If you're reading this message in another frontend (for example, a static rendering on GitHub or NBViewer), it may mean that your frontend doesn't currently support widgets.

I have the following versions:

widgetsnbextension (3.0.8)
ipywidgets (7.0.5)

I installed the widgets with this command:

pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension

Also my code is:

import ipywidgets as widgets
from IPython.display import display

button = widgets.Button(description='Hello')
display(button)

解决方案

I have same versions and code works form me. BEFORE start jupyter notebook. Do you try execute?:

jupyter nbextension enable --py widgetsnbextension --sys-prefix

Output ==>

Enabling notebook extension jupyter-js-widgets/extension...
         - Validating: ok

** http://ipywidgets.readthedocs.io/en/stable/user_install.html shows the installation instructions with pip. Specifies that this mode be used when using virtual environments.

这篇关于Jupyter 小部件未出现在笔记本中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆