An error was reported during debugging using tensorflow: Error: Module 'tensorflow' has no attribute 'gfile' error while running tensorf

An error is reported during debugging with tensorflow:
Error: Module 'tensorflow' has no attribute 'gfile' error while running tensorflow object detection api tutorial
The reason is that my tf version is 2.1.2 and the function name does not correspond to
the solution:
Change the relevant function name Change to: tf.io.gfile.GFile
View tf version:

gym:~$ python
>>>import tensorflow as tf
>>>print(tf.__version__)

The gfile function names corresponding to different versions of TensorFlow:
Version 1: tf.gfile.GFile
Version 2: tf.io.gfile.GFile

Reference:
https://stackoverflow.com/questions/58363136/error-module-tensorflow-has-no-attribute-gfile-error-while-running-tensorfl

Guess you like

Origin blog.csdn.net/Feizhai2/article/details/110143669