pycharm 中的 Flask(python)失败:“缺少必填字段”

pycharm 中的 Flask(python)失败:“缺少必填字段”
from flask import Flask

app = Flask(__name__)


def hello_world():
    return 'Hello World!'


if __name__ == '__main__':
    app.run()

我得到:

Traceback (most recent call last):
  File "app.py", line 3, in <module>
    app = Flask(__name__)
  File "C:\Users\ANAS\PycharmProjects\test\venv\lib\site-packages\flask\app.py", line 559, in __init__
    self.add_url_rule(
  File "C:\Users\ANAS\PycharmProjects\test\venv\lib\site-packages\flask\app.py", line 67, in wrapper_func
    return f(self, *args, **kwargs)
  File "C:\Users\ANAS\PycharmProjects\test\venv\lib\site-packages\flask\app.py", line 1217, in add_url_rule
    self.url_map.add(rule)
  File "C:\Users\ANAS\PycharmProjects\test\venv\lib\site-packages\werkzeug\routing.py", line 1388, in add
    rule.bind(self)
  File "C:\Users\ANAS\PycharmProjects\test\venv\lib\site-packages\werkzeug\routing.py", line 730, in bind
    self.compile()
  File "C:\Users\ANAS\PycharmProjects\test\venv\lib\site-packages\werkzeug\routing.py", line 794, in compile
    self._build = self._compile_builder(False).__get__(self, None)
  File "C:\Users\ANAS\PycharmProjects\test\venv\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

相关内容