簡體   English   中英

jupyter notebooks:如何啟用小部件 javascript?

[英]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

我重新啟動了筆記本,也在這里這里看到了類似的問題,但我仍然遇到同樣的錯誤。

  • 蟒蛇 2.7.12
  • ipywidgets 5.2.2
  • 火狐 56.0
  • Ubuntu 16.04.3

我需要保留ipywidgets版本以測試某些內容。

我找到了解決方案:

確保從系統配置中刪除與jupyternotebookipywidgets可能相關的所有內容,然后將其重新安裝在virtualenv中。 然后運行此enable命令,啟動筆記本計算機,它應該可以工作...

sudo pip install ipywidgets --upgrade

幫助過我

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM