代码一开始就导入了警告库,相关代码如下:
import warnings
warnings.filterswarnings('ignore')当我运行代码时,它显示一个错误
AttributeError: module 'warnings' has no attribute 'filterswarnings'后来,我选择pip install warnings来解决这个问题,然后它出现了
ERROR: Could not find a version that satisfies the requirement warnings (from versions: none)
ERROR: No matching distribution found for warnings 现在,我仍然没有克服这个问题。我该如何克服这个问题呢?
发布于 2021-09-22 05:14:43
这很简单。filterswarnings无效。正如您在docs中看到的,filterwarnings是正确的形式。你需要的是
warnings.filterwarnings('ignore')此外,pip install warnings也不会工作。因为warnings是一个内置库。不能使用pip安装内置库。
https://stackoverflow.com/questions/69278521
复制相似问题