pip install warnings import warnings warnings.filterwarnings("ignore") 如果是在命令行下运行py文件 python -W ignore yourscript.py