cannot import name ContextVar

Flask 启动异常

Unable to load celery application.
While trying to load the module app.celery the following error occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/celery/bin/celery.py", line 53, in convert
    return find_app(value)
  File "/usr/local/lib/python3.7/site-packages/celery/app/utils.py", line 384, in find_app
    sym = symbol_by_name(app, imp=imp)
  File "/usr/local/lib/python3.7/site-packages/kombu/utils/imports.py", line 56, in symbol_by_name
    module = imp(module_name, package=package, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/celery/utils/imports.py", line 100, in import_from_cwd
    return imp(module, package=package)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/app/app.py", line 5, in <module>
    from flask import Flask, Response
  File "/usr/local/lib/python3.7/site-packages/flask/__init__.py", line 7, in <module>
    from .app import Flask as Flask
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 19, in <module>
    from werkzeug.local import ContextVar
ImportError: cannot import name 'ContextVar' from 'werkzeug.local' (/usr/local/lib/python3.7/site-packages/werkzeug/local.py)

flask = 1.0.2 时, Werkzeug1.0.1
flask = 2.0.1 时, Werkzeug
2.0.1

上一篇:IDEA “Cannot resolve symbol” 解决办法


下一篇:MYSQL外键(Foreign Key)的使用