output_notebook()没有定义 - 为什么?

Dir*_*irk 1 python ipython anaconda bokeh

第一次尝试散景.使用bokeh.pydata.org中的以下示例代码:

from collections import OrderedDict

from bokeh.charts import Scatter
from bokeh.sampledata.iris import flowers

output_notebook()
Run Code Online (Sandbox Code Playgroud)

在iPython(Anaconda,py 3.4,Win 7)中,收到以下错误:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-c57c6fa8f51a> in <module>()
----> 1 output_notebook()

NameError: name 'output_notebook' is not defined
Run Code Online (Sandbox Code Playgroud)

为什么?这是直接的例子.

cel*_*cel 6

看起来好像忘了导入output_notebook.

output_notebook教程笔记本有以下进口:

from bokeh.io import output_notebook, show
from bokeh.plotting import figure

output_notebook()
Run Code Online (Sandbox Code Playgroud)

该行output_notebook隐式将output_notebook函数拉入命名空间.

  • 谢谢。不知道。 (2认同)