Python 仍在获取AttributeError:module';tensorflow';没有属性';gfile';在想尽一切办法解决这个问题之后
在使用Python 仍在获取AttributeError:module';tensorflow';没有属性';gfile';在想尽一切办法解决这个问题之后,python,tensorflow,machine-learning,Python,Tensorflow,Machine Learning,在使用tf.gfile.gfile和tf.io.gfile.gfile运行此代码后,我仍然收到此错误。您能帮我吗 视窗10 tensorflow GPU版本:2.1.0 代码 还有这个代码: ` `所以我通过卸载TensorFlow 2.xx解决了这个问题,请安装1x TensorFlow的最新版本 如果您使用的是Google colab,请使用以下命令安装tensorflow 1.15:!pip3安装tensorflow==1.15 此外,您还可以在顶部使用%tensorflow_versio
tf.gfile.gfile
和tf.io.gfile.gfile
运行此代码后,我仍然收到此错误。您能帮我吗
视窗10
tensorflow GPU版本:2.1.0
代码
还有这个代码:
`
`所以我通过卸载TensorFlow 2.xx解决了这个问题,请安装1x TensorFlow的最新版本 如果您使用的是Google colab,请使用以下命令安装tensorflow 1.15:
!pip3安装tensorflow==1.15
此外,您还可以在顶部使用%tensorflow_version 1.x
,以确保您的笔记本电脑只能使用1x
从此处复制两个代码:
!pip3安装tensorflow==1.15
%tensorflow\u版本1.x
`import tensorflow.compat.v1 as tf
detection_graph = tf.Graph()
with detection_graph.as_default():
od_graph_def = tf.GraphDef()
with tf.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
tf.import_graph_def(od_graph_def, name='')
`
import tensorflow as tf
detection_graph = tf.Graph()
with detection_graph.as_default():
od_graph_def = tf.GraphDef()
with tf.io.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
tf.import_graph_def(od_graph_def, name='')