代码之家  ›  专栏  ›  技术社区  ›  Alex Yahiaoui Martinez

plotly/dash-模块“dash_html_components”没有“div”成员

  •  1
  • Alex Yahiaoui Martinez  · 技术社区  · 8 年前

    我想从plotly运行此代码。
    在安装这些模块之前:

    pip install dash==0.21.1  # The core dash backend
    pip install dash-renderer==0.13.0  # The dash front-end
    pip install dash-html-components==0.11.0  # HTML components
    pip install dash-core-components==0.23.0  # Supercharged components
    pip install plotly --upgrade  # Latest Plotly graphing library
    

    我的代码是:

    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': [4, 1, 2], 'type': 'bar', 'name': 'SF'}, 
                    {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
                ],
                'layout': {
                    'title': 'Dash Data Visualization'
                }
            }
        )
    ])
    
    if __name__ == '__main__':
        app.run_server(debug=True)
    

    但是它不起作用,我不明白为什么! 你能帮帮我吗?谢谢

    1 回复  |  直到 8 年前
        1
  •  1
  •   Nils    8 年前

    Python 3 代码可以执行。

    我的软件包版本是:

    dash==0.21.1
    dash-core-components==0.23.0
    dash-html-components==0.11.0
    dash-renderer==0.13.0
    plotly==2.7.0
    

    结果: Dash Webpage