Plotly Dash 加载布局时出错

5 python flask plotly-dash

您好,我是 Dash 新手,我正在按照https://dash.plot.ly/getting-started页面上的教程进行操作,但出现错误,指出未安装 msgpack。我稍后安装了它,然后运行页面上给出的以下代码。

import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()

app.layout = html.Div(children=[
    html.H1(children='Hello Dash'),

    html.Div(children='''
        Dash: A Web Application framework for Python.
        '''),

    dcc.Graph(
        id='example-graph',
        figure={
            'data':[
                {'x':[1,2,3],'y':[2,4,1],'type':'bar','name':'SF'}
            ],
            'layout': {
                'title':'Dash Data Visualisation'
            }
        }
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)
Run Code Online (Sandbox Code Playgroud)

当我继续访问http://127.0.0.1:8050/时,出现以下错误

Error loading layout
Run Code Online (Sandbox Code Playgroud)

我阅读了 dash 文档和社区帮助,提出了一些类似的问题,但我无法理解它们。请帮忙。

小智 1

我再次删除了所有库并重新安装它们,并在 Chrome 中运行了代码。现在工作正常。