为什么 运行 这个 Dash 应用会产生 TypeError
Why does running this Dash app produce a TypeError
我收到以下错误:
"Traceback (most recent call last):
File "app.py", line 11, in <module>
app = dash.Dash()
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\dash\dash.py", line 268, in __init__
self.server = flask.Flask(name) if server else None
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\app.py", line 559, in __init__
self.add_url_rule(
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\app.py", line 67, in wrapper_func
return f(self, *args, **kwargs)
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\app.py", line 1217, in add_url_rule
self.url_map.add(rule)
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 1388, in
add
rule.bind(self)
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 730, in bind
self.compile()
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 794, in compile
self._build = self._compile_builder(False).__get__(self, None)
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 951, in _compile_builder
code = compile(module, "<werkzeug routing>", "exec")
TypeError: required field "type_ignores" missing from Module"
在 运行 一个 Dash 应用程序中。这是我的代码:
import dash
from dash.dependencies import Input, Output
import dash_renderer
import dash_html_components as html # div_tags
import dash_core_components as dcc # graphs
import plotly
app = dash.Dash()
colors = {
'background': '#111111',
'text': '#7FDBFF'
}
app.layout = html.Div(style={'backgroundColor': colors['background']}, children=[
html.H1(
children='Hello Dash',
style={
'textAlign': 'center',
'color': colors['text']
}
),
html.Div(children='Dash: A web application framework for Python.', style={
'textAlign': 'center',
'color': colors['text']
}),
dcc.Graph(
id='Graph1',
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': {
'plot_bgcolor': colors['background'],
'paper_bgcolor': colors['background'],
'font': {
'color': colors['text']
}
}
}
)
])
if __name__ == "__main__":
app.run_server()
我进行了一些搜索,但没有发现任何可以表明此错误含义的信息。谁能提供任何见解?谢谢!
您需要更新您的 Werkzeug 版本才能 Python 3.8 兼容。
我收到以下错误:
"Traceback (most recent call last):
File "app.py", line 11, in <module>
app = dash.Dash()
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\dash\dash.py", line 268, in __init__
self.server = flask.Flask(name) if server else None
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\app.py", line 559, in __init__
self.add_url_rule(
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\app.py", line 67, in wrapper_func
return f(self, *args, **kwargs)
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\flask\app.py", line 1217, in add_url_rule
self.url_map.add(rule)
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 1388, in
add
rule.bind(self)
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 730, in bind
self.compile()
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 794, in compile
self._build = self._compile_builder(False).__get__(self, None)
File "C:\Users\oefel\AppData\Local\Programs\Python\Python38-32\lib\site-packages\werkzeug\routing.py", line 951, in _compile_builder
code = compile(module, "<werkzeug routing>", "exec")
TypeError: required field "type_ignores" missing from Module"
在 运行 一个 Dash 应用程序中。这是我的代码:
import dash
from dash.dependencies import Input, Output
import dash_renderer
import dash_html_components as html # div_tags
import dash_core_components as dcc # graphs
import plotly
app = dash.Dash()
colors = {
'background': '#111111',
'text': '#7FDBFF'
}
app.layout = html.Div(style={'backgroundColor': colors['background']}, children=[
html.H1(
children='Hello Dash',
style={
'textAlign': 'center',
'color': colors['text']
}
),
html.Div(children='Dash: A web application framework for Python.', style={
'textAlign': 'center',
'color': colors['text']
}),
dcc.Graph(
id='Graph1',
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': {
'plot_bgcolor': colors['background'],
'paper_bgcolor': colors['background'],
'font': {
'color': colors['text']
}
}
}
)
])
if __name__ == "__main__":
app.run_server()
我进行了一些搜索,但没有发现任何可以表明此错误含义的信息。谁能提供任何见解?谢谢!
您需要更新您的 Werkzeug 版本才能 Python 3.8 兼容。