如何在Jupyter笔记本中运行Bokeh应用程序?

问题描述 投票:0回答:1

我想在Jupyter笔记本中创建并运行bokeh应用程序。要尝试,我从bokeh教程下载了代码

from bokeh.io import output_notebook, show
output_notebook()
from bokeh.layouts import column
from bokeh.models import TextInput, Button, Paragraph

def modify_doc(doc):

    # create some widgets
    button = Button(label="Say HI")
    input = TextInput(value="Bokeh")
    output = Paragraph()

    # add a callback to a widget
    def update():
        output.text = "Hello, " + input.value
    button.on_click(update)

    # create a layout for everything
    layout = column(button, input, output)

    # add the layout to curdoc
    doc.add_root(layout)

# In the notebook, just pass the function that defines the app to show
# You may need to supply notebook_url, e.g notebook_url="http://localhost:8889" 
show(modify_doc, notebook_url="http://localhost:8888") 

当我在Jupyter笔记本中运行它时,出现以下错误消息:

错误:tornado.application:/ ws中未捕获的异常追溯(最近一次通话):_run_callback中的第494行的文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ tornado \ websocket.py”结果=回调(* args,** kwargs)文件“ C:\ Users \ 123058850 \ AppData \ Roaming \ Python \ Python36 \ site-packages \ bokeh \ server \ views \ ws.py”,第121行,处于打开状态如果self.selected_subprotocol!='bokeh':AttributeError:“ WSHandler”对象没有属性“ selected_subprotocol”

您能帮我理解怎么了吗?

python bokeh tornado attributeerror
1个回答
0
投票

如果在您的环境中,似乎已安装了某些旧的Tornado版本。 tornado.websocket.WebSocketHandler.selected_subprotocol已在Tornado 5.1中出现。

© www.soinside.com 2019 - 2024. All rights reserved.