Python 如何抑制;“未来警告”;张量流?

Python 如何抑制;“未来警告”;张量流?,python,numpy,tensorflow,ubuntu,terminal,Python,Numpy,Tensorflow,Ubuntu,Terminal,我正在ubuntu终端上运行“/buildTF.sh”,它使用TensorFlow。并将错误获取为: /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will

我正在ubuntu终端上运行“/buildTF.sh”,它使用TensorFlow。并将错误获取为:

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516:
FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated;
in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

这是由于numpy版本而发出的警告消息,请卸载当前的numpy版本并将其更新为
1.16.4

# pip uninstall numpy 
# pip install numpy==1.16.4

由于

这些警告是经典的
未来警告
,这意味着您可以使用python标准库中的
警告
模块使它们静音:

导入警告
警告。过滤器警告(“忽略”,消息=r“传递”,类别=FutureWarning)

这将检查
FutureWarning
,并使包含
r“Passing”

的消息静音。如果它与张量流有关,您可以使用以下代码: 导入日志记录
logging.getLogger('tensorflow').disabled=True

,这是否回答了您的问题?