简体   繁体   English

为什么 Tensorflow 即使在我更改文件后也没有属性“gfile”?

[英]Why Tensorflow has no attribute 'gfile' even after I changed the file?

I got error AttributeError: module 'tensorflow' has no attribute 'gfile' so I found online that now we have to change tf.gfile to tf.io.gfile我收到错误AttributeError: module 'tensorflow' has no attribute 'gfile'所以我在网上发现现在我们必须将tf.gfile更改为tf.io.gfile
so I changed it in the C:\Anaconda\lib\site-packages\object_detection\utils\config_util.py but still it is not working for me.所以我在C:\Anaconda\lib\site-packages\object_detection\utils\config_util.py中更改了它,但它仍然不适合我。

Error:错误:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-14-efc7822bb0d7> in <module>
----> 1 config = config_util.get_configs_from_pipeline_file(CONFIG_PATH)

C:\Anaconda\lib\site-packages\object_detection\utils\config_util.py in get_configs_from_pipeline_file(pipeline_config_path, config_override)
     94   """
     95   pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
---> 96   with tf.io.gfile.GFile(pipeline_config_path, "r") as f:
     97     proto_str = f.read()
     98     text_format.Merge(proto_str, pipeline_config)

AttributeError: module 'tensorflow' has no attribute 'gfile'

Can anyone can help me out?任何人都可以帮助我吗?
I am new to this我是新来的

Replace import tensorflow as tf with import tensorflow.compat.v1 as tf and check if it worksimport tensorflow as tf替换为import tensorflow.compat.v1 as tf并检查它是否有效

downgrade to tensorflow 2.3.0 by通过降级到 tensorflow 2.3.0

pip install tensorflow==2.3.0 pip 安装张量流==2.3.0

you can see the diffrent versions from https://www.tensorflow.org/install/source_windows#install_the_package您可以从https://www.tensorflow.org/install/source_windows#install_the_package看到不同的版本

暂无
暂无

声明:本站的技术帖子网页,遵循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 为什么要使用 tensorflow gfile? (用于文件 I/O) - Why use tensorflow gfile? (for file I/O) 仍然得到 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 TensorFlow2.0.0 Alpha-模块'tensorflow'没有属性'gfile' - TensorFlow2.0.0 Alpha- module 'tensorflow' has no attribute 'gfile' AttributeError:模块&#39;tensorflow&#39;没有属性&#39;gfile&#39;Tensorflow 2.8.2 - AttributeError: module 'tensorflow' has no attribute 'gfile' Tensorflow 2.8.2 label_map_util.load_labelmap 错误:模块“tensorflow”没有属性“gfile” - label_map_util.load_labelmap Error: module 'tensorflow' has no attribute 'gfile' 为什么使用pd.DataFrame之后我的txt文件已更改? - Why my txt file has been changed after I used pd.DataFrame? 即使 cwd 已更改也访问文件 - Access a file even if the cwd has changed 模块“tensorflow”没有属性“read_file” - module 'tensorflow' has no attribute 'read_file' 为什么我得到“AttributeError: class<class name> 没有属性<attribute name> &quot;即使我已经明确定义了属性 - why I get "AttributeError: class <class name> has no attribute <attribute name>" even I've clearly defined the attribute
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM