ImportError: cannot import name 'cached_property' from 'werkzeug'

created at 04-09-2022 views: 482

solution

After some searching, I learned that this is because the new version of werkzeug needs to import the module explicitly.

Adding the following code to the error file (my here is werkzeug/init.py) can solve the problem.

from werkzeug.utils import cached_property
  • File path under CentOS system: /usr/local/lib/python3.7/site-packages/werkzeug
  • File path under Ubuntu system: /usr/local/lib/python3.6/dist-packages/werkzeug
  • File path under MAC system: /usr/local/lib/python3.7/site-packages/werkzeug
created at:04-09-2022
edited at: 06-02-2022: