gpt4 book ai didi

python - 尝试 dash 应用程序时使用 stat 重新启动

转载 作者:行者123 更新时间:2023-12-05 05:17:36 24 4
gpt4 key购买 nike

我正在尝试用 python 学习 dash 应用程序包,我从下面的基本教程开始,

import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()

app.layout = html.Div(' Dash Tutorials')

if __name__ == '__main__':
app.run_server(debug=True)

但是我收到以下错误,

* Restarting with stat

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

SystemExit: 1

当我输入 %tb 时,出现以下内容,

---------------------------------------------------------------------------
SystemExit Traceback (most recent call last)
<ipython-input-5-5d4a332652ef> in <module>()
32
33 if __name__ == '__main__':
---> 34 app.run_server(debug=True)

C:\Users\username\AppData\Local\Continuum\anaconda27\lib\site-packages\dash\dash.pyc in run_server(self, port, debug, **flask_run_options)
564 debug=False,
565 **flask_run_options):
--> 566 self.server.run(port=port, debug=debug, **flask_run_options)

C:\Users\username\AppData\Local\Continuum\anaconda27\lib\site-packages\flask\app.pyc in run(self, host, port, debug, **options)
839 options.setdefault('use_debugger', self.debug)
840 try:
--> 841 run_simple(host, port, self, **options)
842 finally:
843 # reset the first request information if the development server

C:\Users\username\AppData\Local\Continuum\anaconda27\lib\site-packages\werkzeug\serving.pyc in run_simple(hostname, port, application, use_reloader, use_debugger, use_evalex, extra_files, reloader_interval, reloader_type, threaded, processes, request_handler, static_files, passthrough_errors, ssl_context)
735 from werkzeug._reloader import run_with_reloader
736 run_with_reloader(inner, extra_files, reloader_interval,
--> 737 reloader_type)
738 else:
739 inner()

C:\Users\username\AppData\Local\Continuum\anaconda27\lib\site-packages\werkzeug\_reloader.pyc in run_with_reloader(main_func, extra_files, interval, reloader_type)
263 reloader.run()
264 else:
--> 265 sys.exit(reloader.restart_with_reloader())
266 except KeyboardInterrupt:
267 pass

SystemExit: 1

我已经尝试了几种方法来解决这个问题。但我无法找到解决方案。谁能帮我解决这个问题?

谢谢

最佳答案

在禁用 Debug模式的情况下运行它:

if __name__ == '__main__':
app.run_server(debug=False)

关于python - 尝试 dash 应用程序时使用 stat 重新启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49092918/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com