tensorflow报错raise RuntimeError('The Session graph is empty. Add operations to the '
RuntimeError: The Session graph is empty. Add operations to the graph before calling run().
这个是在安装tensorflow的时候为了测试安装是否成功,然后就用了网上的方法,但是在运行如下代码的时候却产生了错误
# os.environ["TF_CPP_MIN_LOG_LEVEL"]='1' # 这是默认的显示等级,显示所有信息
os.environ["TF_CPP_MIN_LOG_LEVEL"]='2'
一开始是怀疑自己本地问题tensorflow没有下载全,后来百度了下没有解决,又想到是不是安装过程出错了,问题还真的就在这里,在我创建好tensorflow环境后,执行pip install tensorflow 这个默认下载的是2.0.0版本的,但是conda却不支持,所以我们在下载前要看看conda支持的tensorflow
版本,执行下边命令conda search --full -name tensorflow,如图