[英]jupyter notebooks: How to enable widget javascript?
我正在嘗試在 virtualenv 中運行 jupyter notebook。 但是當啟動它並創建一個簡單的ipywidgets
示例時,我收到以下錯誤:
Widget Javascript not detected. It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"
示例代碼在這里:
from ipywidgets import Button, HBox
from ipywidgets import *
button = Button()
button.description = "Test"
display(button)
我在終端上運行了以下命令:
jupyter nbextension enable --py widgetsnbextension
jupyter nbextension enable --py --sys-prefix widgetsnbextension
我重新啟動了筆記本,也在這里和這里看到了類似的問題,但我仍然遇到同樣的錯誤。
我需要保留ipywidgets
版本以測試某些內容。
我找到了解決方案:
確保從系統配置中刪除與jupyter
, notebook
, ipywidgets
可能相關的所有內容,然后將其重新安裝在virtualenv中。 然后運行此enable
命令,啟動筆記本計算機,它應該可以工作...
sudo pip install ipywidgets --upgrade
幫助過我
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.