使用tensorflow调试过程中报错: Error: Module ‘tensorflow‘ has no attribute ‘gfile‘ error while running tensorf

使用tensorflow调试过程中报错:
Error: Module ‘tensorflow’ has no attribute ‘gfile’ error while running tensorflow object detection api tutorial
原因是因为我的tf版本是2.1.2 函数名不对应
解决方法:
将相关的函数名改为: tf.io.gfile.GFile
查看tf版本:

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

TensorFlow不同版本对应的gfile函数名:
Version 1 : tf.gfile.GFile
Version 2 : tf.io.gfile.GFile

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

猜你喜欢

转载自blog.csdn.net/Feizhai2/article/details/110143669
今日推荐