简体   繁体   English

ImportError:无法从“集合”导入名称“映射”,烧瓶导入不起作用

[英]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.

相关问题 pip ImportError:无法从“集合”导入名称“映射” - pip ImportError: cannot import name 'Mapping' from 'collections' ImportError:无法从“集合”导入名称“迭代器” - ImportError: cannot import name 'Iterator' from 'collections' ImportError:无法从“集合”导入名称“Sized” - ImportError: cannot import name 'Sized' from 'collections' ImportError:无法从“集合”导入名称“MutableMapping” - ImportError: cannot import name 'MutableMapping' from 'collections' 未检测到的 chromedriver 导入不成功。 导入错误:无法从“集合”导入名称“映射” - undetected-chromedriver import is unsuccessful. ImportError: cannot import name 'Mapping' from 'collections' ImportError:无法从 flask 导入名称“模板” - ImportError: cannot import name 'templates' from flask 无法从“集合”导入名称“映射” - Cannot import name 'Mapping' from 'collections' Flask ImportError:无法导入名称” - Flask ImportError: cannot import name '' Python:ImportError: cannot import name 'Mapping' from 'collections' (C:\Program Files\Python310\lib\collections\__init__.py) - Python : ImportError: cannot import name 'Mapping' from 'collections' (C:\Program Files\Python310\lib\collections\__init__.py) 基本烧瓶:ImportError:无法导入名称烧瓶 - Basic Flask: ImportError: cannot import name Flask
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM