我正在 vs code 中运行这个简单的 Flask 应用程序。将其 Docker 化并加载到 ECS。任务正在退出并出现以下错误:
ImportError:无法从“集合”(/usr/local/lib/python3.10/collections/)导入名称“MutableMapping”init.py)
我使用的基础镜像是python3.10。
以下是dockerfile代码:
FROM python:3.10
WORKDIR /usr/src/app
COPY . .
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 5000
为什么我会收到此错误?
在 python 3.9 中尝试以下操作:
>>> from collections import MutableMapping
<stdin>:1: 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
所以我猜你的问题是你正在使用 python 3.10 你需要做的事情:
>>> from collections.abc import MutableMapping
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)