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

时间:2015-03-07 17:31:21

标签: python ipython anaconda bokeh

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

from collections import OrderedDict

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

output_notebook()

在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

为什么呢?这是直接的例子。

1 个答案:

答案 0 :(得分:6)

您好像忘记导入output_notebook

scatterplot教程笔记本具有以下导入:

from collections import OrderedDict

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

output_notebook()

from bokeh.plotting import *隐式将output_notebook函数拉入命名空间。