首页 > 很简单的几句python代码,为什么直接Process finished with exit code 2呢?

很简单的几句python代码,为什么直接Process finished with exit code 2呢?

直接运行就这样了

前几天还可以的..不知道怎么突然就不行了.

求熟手帮忙看看原因.


flask-script 这个插件的用法是在命令行里输入

python hello.py runserver

使用 pycharmrun 功能,只是执行 python hello.py, 并没有添加 runserver 参数。因此脚本没有参数就执行完毕了。

解决方案就是在 在 run选项的下拉箭头,选择 edit configure选项,然后在 script parameters里添加即可


运行的时候没有加参数


提示里已经有了

usage: hello.py [-?] {runserver, shell} ...

试下

python.exe D:\...\hello.py runserver

或者将最后一行代码改成

app.run()
【热门文章】
【热门文章】