AttributeError: 模块 'typing' 没有属性 'NoReturn'

时间:2021-05-17 11:45:42

标签: python flask python-typing

import flask
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\vigne\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\__init__.py", line 17, in <module>
    from werkzeug.exceptions import abort
  File "C:\Users\vigne\AppData\Local\Programs\Python\Python36\lib\site-packages\werkzeug\__init__.py", line 1, in <module>
    from .serving import run_simple
  File "C:\Users\vigne\AppData\Local\Programs\Python\Python36\lib\site-packages\werkzeug\serving.py", line 31, in <module>
    from .exceptions import InternalServerError
  File "C:\Users\vigne\AppData\Local\Programs\Python\Python36\lib\site-packages\werkzeug\exceptions.py", line 884, in <module>
    class Aborter:
  File "C:\Users\vigne\AppData\Local\Programs\Python\Python36\lib\site-packages\werkzeug\exceptions.py", line 906, in Aborter
    ) -> t.NoReturn:
AttributeError: module 'typing' has no attribute 'NoReturn'

每当我尝试导入 Flask 时都会收到此错误。

目前,我使用的是 Python 版本 3.6.0

2 个答案:

答案 0 :(得分:0)

他们在新版本的 Flask 2.0.1 中修复了这个问题
https://github.com/pallets/flask/issues/4040

尝试使用 pip install Flask --upgrade

更新烧瓶

答案 1 :(得分:0)

我遇到了同样的问题,它与您使用的 Python==3.6.0 版本有关。按照 Alveona 的建议,将其升级到 3.6.2 解决了这个问题。

相关问题