Python 如何抑制这些警告

Python 如何抑制这些警告,python,tensorflow,logging,Python,Tensorflow,Logging,经过一些谷歌搜索,我找到了这段代码,但它不起作用 warnings.filterwarnings("ignore") 以下内容仍然显示警告消息,如下所示 2021-05-27 22:04:57.755845: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_1

经过一些谷歌搜索,我找到了这段代码,但它不起作用

warnings.filterwarnings("ignore")
以下内容仍然显示警告消息,如下所示

2021-05-27 22:04:57.755845: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2021-05-27 22:04:57.756056: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.


2021-05-27 22:05:39.988042: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2021-05-27 22:05:39.988241: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
2021-05-27 22:05:39.996417: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: (machine name)
2021-05-27 22:05:39.996655: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: (username)
2021-05-27 22:05:39.997423: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.

2021-05-27 22:05:40.926604: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:176] None of the MLIR Optimization Passes are enabled (registered 2)

如有任何建议,将不胜感激。

以下解决方案将停止显示Tensorflow警告

import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)

人们需要更多关于您试图抑制的警告的上下文。请添加一些关于代码的上下文。