首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IPython.html.widgets in IPython say:没有名为widgets的模块

IPython.html.widgets in IPython say:没有名为widgets的模块
EN

Stack Overflow用户
提问于 2016-05-05 19:19:58
回答 1查看 3.5K关注 0票数 2

所有人的上帝之日。我正试图在木星+ IPython环境下,执行由Cirille的"IPython交互式计算--可视化烹饪“一书中的代码。

在我尝试之前,一切都很好:

代码语言:javascript
复制
from collections import OrderedDict
from IPython.display import (display, clear_output, YouTubeVideo)
from IPython.html.widgets import DropdownWidget

如果我确实重新启动内核,则会出现以下消息:

代码语言:javascript
复制
/usr/local/lib/python3.4/dist-packages/IPython/html.py:14: ShimWarning: The `IPython.html` package has been deprecated. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.
  "`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning)

然后,我试图通过以下方式更改第三行(问题):

代码语言:javascript
复制
from ipywidgets import DropdownWidgets

但朱庇特回答:ImportError: cannot import name 'DropdownWidget'

有人能帮帮我吗?

下一个是部分答案

好吧,在这个网页上我找到了ipywidgets安装对我的问题和问题的答案。

我试着做下一个例子,做得很好:

代码语言:javascript
复制
import numpy as np
url = "http://donnees.ville.montreal.qc.ca/dataset/f170fecc-18db-44bc-b4fe-5b0b6d2c7297/resource/ec12447d-6b2a-45d0-b0e7-fd69c382e368/download/2013.csv"
df = pd.read_csv(url, index_col='Date', parse_dates=True, dayfirst=True)
from ipywidgets import interact
@interact
def plot(n=(1, 30)):
    pd.rolling_mean(df['Berri1'], n).dropna().plot()
    plt.ylim(0, 8000)
    plt.show()

但是jupyter声称我必须这样做:jupyter nbextension enable --py --sys-prefix widgetsnbextension

我去了终点站,听从了我的建议,并回答说:

代码语言:javascript
复制
Configure an nbextension to be automatically loaded

Options
-------

Arguments that take values are actually convenience aliases to full
Configurables, whose aliases are listed on the help line. For more information
on full configurables, see '--help-all'.

--debug
    set log level to logging.DEBUG (maximize logging output)
-y
    Answer yes to any questions instead of prompting.
--generate-config
    generate default config file
--section=<Unicode> (EnableNBExtensionApp.section)
    Default: 'notebook'
    Which config section to add the extension to. 'common' will affect all
    pages.

To see all available configurables, use `--help-all`

[EnableNBExtensionApp] CRITICAL | Bad config encountered during initialization:
[EnableNBExtensionApp] CRITICAL | Unrecognized flag: '--py'

看一下,在1中有这样的建议:jupyter nbextension enable --py widgetsnbextension,但是在控制台中建议使用jupyter nbextension enable --py --sys-prefix widgetsnbextension。请注意,有一点差别,但在这两种情况下出现相同的错误关于--py选项

在这一刻,这个问题得到了部分回答。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-10 11:51:28

好吧,在网页上查找我在jupyter页面(jupyter)上找到的重新浏览过的笔记本,几乎可以很好地运行(除了一些例外,至少在第01章,我去尝试其他章节)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37058637

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档