所以,我刚刚第一次安装了 Ubuntu,并试图运行一个非常简单的 Python 项目。第一次运行时,我收到了 collections.abc 弃用警告,它提示我确保我的项目是最新的。
经过进一步调查,我发现仅运行 py 命令会导致此弃用警告,如下所示:
Documents$ py
/usr/bin/py:16: 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
from collections import Iterable
有什么想法可以解决这个问题吗?我已经从系统中删除了 Python 2 并确保 Python 3 是最新的。
最佳答案
发现这与您的问题有关:
https://programmerah.com/solved-python3-10-error-cannot-import-name-iterable-from-collections-46165/
此外,在 Unix/Linux 中,对 Python 环境的调用是“python”而不是 py。
关于python - 在 Ubuntu 中调用 py 导致 collections.abc 弃用警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70606072/