我尝试在python中使用gfile模块(anaconda 3,Windows 10)。 它在主要代码中正常工作,但是当我尝试导入库时,它说该模块不存在。
当我这样输入主代码时:
tf.compat.v2.io.gfile.GFile(PATH_TO_CKPT , 'rb')
回复:
<tensorflow.python.platform.gfile.GFile at 0x1a3c680b248>.
但是当我尝试这样导入时:
label_map = label_map_util.load_labelmap(PATH_TO_LABELS)
它回复:
<ipython-input-96-c747d547cad8> in <module>
----> 1 label_map = label_map_util.load_labelmap(PATH_TO_LABELS)
~\models\research\object_detection\utils\label_map_util.py in load_labelmap(path)
136 Returns:
137 a StringIntLabelMapProto
--> 138 """
139
140 with tf.compat.v2.io.gfile.GFile(path, 'r') as fid:
AttributeError: module 'tensorflow' has no attribute 'gfile'