IPython Notebook ipywidgets 不显示
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36351109/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IPython Notebook ipywidgets does not show
提问by Cliff Chew
I created a table with an interactive slider that allows me to toggle between different periods on my table. It was working for the past few days, until today, when I re-ran the notebook, the slide bar doesn't show anymore. No error messages appear. The code seem to run just fine, as the table appears, but the slide bar just doesn't appear. I didn't change my code either, as I was working on a separate part of my notebook.
我创建了一个带有交互式滑块的表格,允许我在表格的不同时间段之间切换。过去几天它一直在工作,直到今天,当我重新运行笔记本时,滑块不再显示。不会出现错误消息。当表格出现时,代码似乎运行得很好,但只是没有出现滑动条。我也没有更改代码,因为我正在处理笔记本的一个单独部分。
I tried many approaches, including searching in this space but was still unable to come up with a solution. I was wondering if anyone faced a similar issue, and have any solution to this.
我尝试了很多方法,包括在这个空间中搜索,但仍然无法提出解决方案。我想知道是否有人遇到过类似的问题,并且对此有任何解决方案。
Below is my code snippet. Anything before was solely to get my data into the desired form for tabulation.
下面是我的代码片段。之前的任何事情都只是为了将我的数据转换为所需的表格形式。
from IPython.display import display
from ipywidgets import widgets, interactive
v = interactive(by_q, quarter=(['q1y2015', 'q2y2015', 'q3y2015', 'q4y2015']), days=(1, 180))
display(v)
回答by Elaine Hale
With the new version of ipywidgets
, I ran into this problem, but then I found on their github readmethat you now need to follow
使用新版本的ipywidgets
,我遇到了这个问题,但后来我在他们的 github 自述文件中发现您现在需要遵循
pip install ipywidgets
with
和
jupyter nbextension enable --py widgetsnbextension
That cleared the problem up for me.
这为我解决了问题。
回答by Alexander Svetly
After googling for a while without hope, I realized that I need
在没有希望的情况下搜索了一段时间后,我意识到我需要
jupyter labextension install @jupyter-widgets/jupyterlab-manager
回答by 5agado
Might have been a stupid mistake of mine, but in case you are using virtual environments, just keep properly in mind what is running from where.
可能是我犯的一个愚蠢的错误,但是如果您使用的是虚拟环境,请正确记住从何处运行的内容。
You might properly run Jupyter from inside your current environment every time as needed, or might have a root env from which you always start the Jupyter you will end up using for all your environments.
您可能每次都根据需要从当前环境中正确运行 Jupyter,或者可能有一个根环境,您总是从中启动 Jupyter,最终将用于所有环境。
For the latter case, what you need to be sure is to enable nbextension for the Jupyter you are actually running, instead of mistakenly run the command from within your currently active environment.
对于后一种情况,您需要确保为您实际运行的 Jupyter 启用 nbextension,而不是在当前活动的环境中错误地运行命令。
回答by nluigi
I think plot.ly imports a function called display
which overrides the function display
from ipython. Try changing the order of imports or simply import the function under a different name
我认为 plot.ly 导入了一个函数display
,该函数覆盖了display
ipython 中的函数。尝试更改导入顺序或简单地以不同的名称导入函数