[英]ImportError: cannot import name 'Mapping' from 'collections', flask import not working
Today I've tried to import an inventory management flask app and i have faced many errors.今天我尝试导入一个库存管理烧瓶应用程序,但遇到了很多错误。 Hope you can help me, with this project, It's from github https://github.com/marination/Inventory-Manager
希望你能帮助我,这个项目来自 github https://github.com/marination/Inventory-Manager
and these are the errors:这些是错误:
Traceback (most recent call last):
File "C:\workspace\Inventory-Manager\run.py", line 1, in <module>
from flaskinventory import app
File "C:\workspace\Inventory-Manager\flaskinventory\__init__.py", line 1, in <module>
from flask import Flask
File "C:\workspace\Inventory-Manager\ven\lib\site-packages\flask\__init__.py", line 19, in <module>
from jinja2 import Markup, escape
File "C:\workspace\Inventory-Manager\ven\lib\site-packages\jinja2\__init__.py", line 33, in <module>
from jinja2.environment import Environment, Template
File "C:\workspace\Inventory-Manager\ven\lib\site-packages\jinja2\environment.py", line 16, in <module>
from jinja2.defaults import BLOCK_START_STRING, \
File "C:\workspace\Inventory-Manager\ven\lib\site-packages\jinja2\defaults.py", line 32, in <module>
from jinja2.tests import TESTS as DEFAULT_TESTS
File "C:\workspace\Inventory-Manager\ven\lib\site-packages\jinja2\tests.py", line 13, in <module>
from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections'
(C:\Python310\lib\collections\__init__.py)
collections.Mapping
has been deprecated since Python 3.3 and was removed from the collections
module In Python 3.10. collections.Mapping
自 Python 3.3 以来已被弃用,并已从 Python 3.10 中的collections
模块中删除。 In Python 3.3 - 3.9 you should see something like the following warning:在 Python 3.3 - 3.9 中,您应该看到类似于以下警告的内容:
DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
DeprecationWarning:从 Python 3.3 开始,不推荐使用或从“collections”而不是“collections.abc”导入 ABC,在 3.10 中它将停止工作
These imports need to be updated for Python 3.10 to import Mapping
from collections.abc
这些导入需要为 Python 3.10 更新以从
collections.abc
导入Mapping
In this case, the import is happening in jinja2
.在这种情况下,导入发生在
jinja2
中。 To resolve this, use an updated version of jinja2
which fixes this issue or use Python 3.9 or earlier.要解决此问题,请使用修复此问题的
jinja2
更新版本或使用 Python 3.9 或更早版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.