python - Python dash 给了我一个“错误加载布局”我该如何解决这个问题?
问题描述
嘿,我是 Python Dash 的新手,我遵循了https://dash.plot.ly/installation教程。
首先,我在我的 cmd shell 中安装了所有带有 pip 的库。
之后,我创建了 app.py 文件并添加了以下代码:
import dash
import dash_core_components as dcc
import dash_html_components as html
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
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)
到目前为止还没有错误。当我启动服务器并转到http://127.0.0.1:8050时,网页给了我一个错误:“加载布局错误”。
我试图通过所有其他报告来寻求帮助,但我仍然找不到答案。
我希望有人可以帮助我。
非常感谢!
解决方案
我成功地运行了这个没有问题,所以我认为这是一个你的模块不完整的问题。尝试通过 pip 或 conda 重新安装所有底层模块(dash、dcc 和 html),看看是否能解决问题。
推荐阅读
- sql - Connect By 子句适用于 11g,但不适用于 Oracle 8i:“ORA-01436:用户数据中的 CONNECT BY 循环”
- checkout - BigCommerce - 自定义运输方式(用于收集位置的 RoyalMail 小部件)
- javascript - 如何正确利用 settimeout 函数用 three.js 旋转立方体
- sql - 加入 CTE 按月/年分组
- kubernetes - Kubernetes 中容器挂载的间歇性失败
- javascript - 有没有办法在反应应用程序中链接非反应 html 文件?
- javascript - 当 /dist/ 文件夹不存在时,Vue js 如何从 /dist/ 文件夹加载图像?
- variables - SSIS - 模块化“子”包 - 变量范围并将变量传递给包
- python - 在 SQLITE3 上关闭和删除后如何再次打开数据库
- java - InfluxDB 空结果集