[英]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 works将import 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.