尝试在Spyder IPython控制台中初始化Dash时出错 - python

尝试使用Dash运行简单的仪表板时出现错误。我在Python 3.4中使用Spyder。我pip installed dash, dash_core_components, dash_html_compenents ..

我的代码:

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)

取自Dash/Plotly website tutorial

我收到以下错误:

 * Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)
 * Restarting with stat
C:\Users\mwolfe\AppData\Local\Continuum\anaconda3\envs\py34\lib\site-packages\IPython\core\interactiveshell.py:2889: UserWarning:

To exit: use 'exit', 'quit', or Ctrl-D.

An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

当我转到http://127.0.0.1:8050/尝试查看示例仪表板时,它将不会加载。

我已经尝试过this来解决此问题,但是还无法使其正常工作。

python大神给出的解决方案

设置debug=False确实可以解决问题,但Jupyter Notebook和Spyder不能解决。当使用笔记本/ spyder执行时,代码陷入困境。

将您的代码更改为debug=False并在Anaconda Navigator随附的PyQt控制台中执行。有用。

Python pytz时区函数返回的时区为9分钟 - python

由于某些原因,我无法从以下代码中找出原因:>>> from pytz import timezone >>> timezone('America/Chicago') 我得到:<DstTzInfo 'America/Chicago' LMT-1 day, 18:09:00 STD…

用大写字母拆分字符串,但忽略AAA Python Regex - python

我的正则表达式:vendor = "MyNameIsJoe. I'mWorkerInAAAinc." ven = re.split(r'(?<=[a-z])[A-Z]|[A-Z](?=[a-z])', vendor) 以大写字母分割字符串,例如:'我的名字是乔。 I'mWorkerInAAAinc”变成…

Python:同时在for循环中添加到列表列表 - python

我想用for循环外的0索引值创建一个新列表,然后使用for循环添加到相同的列表。我的玩具示例是:import random data = ['t1', 't2', 't3'] masterlist = [['col1', 'animal1', 'an…

Python:来自dict系列的Pandas数据框 - python

我有一个熊猫数据框:type(original) pandas.core.frame.DataFrame 其中包括系列对象original['user']:type(original['user']) pandas.core.series.Series original['user']指向许多命令:…

如何获取Python中所有内置函数的列表 - python

当我们从中获取关键字列表时,如何从Python提示符中获取Python中所有内置函数的列表? python大神给出的解决方案 更新:关于__builtins__或__builtin__可能会有一些混淆。What’s New In Python 3.0建议使用builtins 将模块__builtin__重命名为builtins(删除下划线, 添加一个“ s”…