gpt4 book ai didi

Python:Hello world with Flask 给我一个与 app.run(debug=True) 相关的错误

转载 作者:太空狗 更新时间:2023-10-29 21:51:50 26 4
gpt4 key购买 nike

<分区>

我是 Flask 的新手(对 python 也是新手),我尝试运行以下非常基本的脚本:

from flask import Flask
app= Flask(__name__)
@app.route('/')
def home():
return "This is the homepage"
if __name__=="__main__":
app.run(debug=True)

我在 Windows 10 上使用 Python 3.6 和 IDLE。问题是我不断收到以下错误:

Traceback (most recent call last):
File "C:/Users/Susy/Desktop/provaflask.py", line 7, in <module>
app.run(debug=True)
File "C:\Users\Susy\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 936, in run
cli.show_server_banner(self.env, self.debug, self.name, False)
File "C:\Users\Susy\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\cli.py", line 630, in show_server_banner
click.echo(message)
File "C:\Users\Susy\AppData\Local\Programs\Python\Python36\lib\site-packages\click\utils.py", line 217, in echo
file = _default_text_stdout()
File "C:\Users\Susy\AppData\Local\Programs\Python\Python36\lib\site-packages\click\_compat.py", line 621, in func
rv = wrapper_func()
File "C:\Users\Susy\AppData\Local\Programs\Python\Python36\lib\site-packages\click\_compat.py", line 385, in get_text_stdout
rv = _get_windows_console_stream(sys.stdout, encoding, errors)
File "C:\Users\Susy\AppData\Local\Programs\Python\Python36\lib\site-packages\click\_winconsole.py", line 261, in _get_windows_console_stream
func = _stream_factories.get(f.fileno())
io.UnsupportedOperation: fileno

来自 this question , 问题似乎与IDLE的使用有关,但是我想继续使用它,请问您能帮忙吗?谢谢!

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