禁用tensorflow操作系统级别警告。

2024-05-04 10:02:14 发布

您现在位置:Python中文网/ 问答频道 /正文

对不起问题。首先时间安装张量-流动。而测试是否正确安装,获取错误/警告tf.会议(). 在

使用Python3.5。在

编码

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

错误

^{pr2}$

输出

b'Hello, tensor-flow'

Tags: import警告hello编码sessiontftensorflowas
1条回答
网友
1楼 · 发布于 2024-05-04 10:02:14

设置正确的os级日志可以删除警告

import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='3'
import tensorflow as tf

# Also to remove permanently, add the following line to your ~/.bashrc file
export TF_CPP_MIN_LOG_LEVEL=3

相关问题 更多 >