弃用警告 python3.8 包

eaf*_*res 6 python

我在 Windows 11 内部版本(版本 22523)下的 WSLg 中运行 Ubuntu 20.04。当我做某些与 Python 相关的事情时,我不断收到这两个警告:

/home/eafpres/.local/lib/python3.8/site-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.23ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
/home/eafpres/.local/lib/python3.8/site-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.36ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
Run Code Online (Sandbox Code Playgroud)

例如,我刚刚做了: pip install plotly

并得到了这些,但安装工作正常。同样,当我启动 IDE (Spyder) 时,我也会得到它们。

我的 Ubuntu 安装有问题吗?

小智 3

.local/lib/python3.8/site-packages/pkg_resources文件夹重命名为pkg_resources_back. 之后,所有警告都应该消失。

pip list应该也可以工作,但是您需要检查其他事情是否也可以工作。


小智 1

该模块作为setuptools. setuptools如果您不需要这个包,可以通过卸载来删除它。

您的系统中很可能setuptools安装了 Ubuntu 存储库中的另一个版本(当前 Ubuntu 20.04 中的版本为 45.2)。您可以通过运行来确认:

apt list | grep setuptools
Run Code Online (Sandbox Code Playgroud)

如果没有,您可以安装这个setuptools,如果那个过时的版本适合您的话,它应该与您的 Ubuntu 系统更兼容。