简体   繁体   English

AttributeError:模块'tensorflow'没有属性'gfile'Tensorflow 2.8.2

[英]AttributeError: module 'tensorflow' has no attribute 'gfile' Tensorflow 2.8.2

can someone please help me with this error....I tried using tf.io.gfile instead of tf.gfile then to its not working有人可以帮我解决这个错误....我尝试使用 tf.io.gfile 而不是 tf.gfile 然后它不起作用

error shown is still the same显示的错误仍然相同

AttributeError: module 'tensorflow' has no attribute 'gfile' AttributeError:模块“tensorflow”没有属性“gfile”

tf.gfile is now submodule of tf.io , which you can use by giving an updated full alias name tf.io.gfile.GFile . tf.gfile现在是tf.io的子模块,您可以通过提供更新的完整别名tf.io.gfile.GFile来使用它。

Please check below code for your reference:请检查以下代码以供参考:

import tensorflow as tf
print(tf.__version__)

with open("/tmp/x", "w") as f:
  print(f.write("asdf"))
  
with tf.io.gfile.GFile("/tmp/x") as f:   # <----using tf.io.gfile.GFile
  print(f.read())

Output:输出:

2.8.2
4
asdf

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AttributeError:即使在第 131 行将 tf.gfile.* 更改为 tf.io.gfile.*,模块“tensorflow”也没有属性“gfile” - AttributeError: module 'tensorflow' has no attribute 'gfile' even when changed tf.gfile.* to tf.io.gfile.* in line 131 TensorFlow2.0.0 Alpha-模块'tensorflow'没有属性'gfile' - TensorFlow2.0.0 Alpha- module 'tensorflow' has no attribute 'gfile' 仍然得到 AttributeError: module &#39;tensorflow&#39; has no attribute &#39;gfile&#39; 在尝试了每件事来解决这个问题之后 - Still getting AttributeError: module 'tensorflow' has no attribute 'gfile' after trying every thing to solve that AttributeError: 模块“tensorflow”没有属性“GraphDef” - AttributeError: module 'tensorflow' has no attribute 'GraphDef' AttributeError:模块“ tensorflow”没有属性“ keras” - AttributeError: module 'tensorflow' has no attribute 'keras' 属性错误:模块“tensorflow”没有属性“变量”“错误” - AttributeError: module 'tensorflow' has no attribute 'Variable' “ERROR” AttributeError: 模块“tensorflow”没有属性“layers” - AttributeError: module 'tensorflow' has no attribute 'layers' AttributeError:模块“tensorflow”没有属性“assign” - AttributeError: module 'tensorflow' has no attribute 'assign' tensorflow AttributeError: 'module' object 没有属性 'data' - tensorflow AttributeError: 'module' object has no attribute 'data' AttributeError: 模块 'tensorflow' 没有属性 'placeholder' - AttributeError: module 'tensorflow' has no attribute 'placeholder'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM