简体   繁体   中英

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

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. In Python 3.3 - 3.9 you should see something like the following warning:

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

These imports need to be updated for Python 3.10 to import Mapping from collections.abc

In this case, the import is happening in jinja2 . To resolve this, use an updated version of jinja2 which fixes this issue or use Python 3.9 or earlier.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM