问题:我在MacOs 10.9中使用pip3安装了python3和jupyter笔记本。
当我尝试运行窗口小部件时,出现错误,提示没有javascript小部件。我在Jupyter-notebook中安装了python3和R内核。
码:
from ipywidgets import widgets
from IPython.display import display
text = widgets.Text()
display(text)
text.on_submit('hello')
Run Code Online (Sandbox Code Playgroud)
错误:
Widget Javascript not detected. It may not be installed or enabled properly.
Run Code Online (Sandbox Code Playgroud)
尝试次数:
sudo -H pip3 install ipywidgets
sudo -H pip3 install -upgrade ipywidgets
jupyter nbextension enable --py widgetsnbextension
# restarted the computer.
Run Code Online (Sandbox Code Playgroud)
最后一条命令给出错误。
[EnableNBExtensionApp] CRITICAL | Bad config encountered during initialization:
[EnableNBExtensionApp] CRITICAL | Unrecognized flag: '--py'
Run Code Online (Sandbox Code Playgroud)
请注意,在Mac中,我有jupyter-nbextension命令,但该命令为:
jupyter-nbextension enable --py widgetsnbextension
Run Code Online (Sandbox Code Playgroud)
也不起作用。
但是jupyter nbextension enable widgetsnbextension没有错误,也没有任何作用。如果运行代码,则会弹出相同的错误。
也,
import ipywidgets
ipywidgets.__version__
Run Code Online (Sandbox Code Playgroud)
给出“ 6.0.0”。
一些注意事项:
which jupyter
jupyter is /Library/Frameworks/Python.framework/Versions/3.5/bin/jupyter
which jupyter-notebook
jupyter-notebook is /Library/Frameworks/Python.framework/Versions/3.5/bin/jupyter-notebook
Run Code Online (Sandbox Code Playgroud)
相关链接:
https://github.com/jupyter-widgets/ipywidgets/issues/541
https://github.com/jupyter/help/issues/32
https://github.com/jupyter/help/issues/131
https://github.com/binder-project/binder/issues/83
Run Code Online (Sandbox Code Playgroud)
如何安装小部件?
我需要单独安装Java吗?
小智 6
chjortlund 的答案对我不起作用,因为我没有 root 权限。这为我解决了这个问题:
pip3 install --upgrade ipywidgets
jupyter nbextension enable --py widgetsnbextension
Run Code Online (Sandbox Code Playgroud)
运行以下命令:
jupyter nbextension enable --py --sys-prefix widgetsnbextension,然后在Jupyter中重新启动内核即可解决问题。
| 归档时间: |
|
| 查看次数: |
6764 次 |
| 最近记录: |