如何修复错误:“ AttributeError:在Windows上,模块'tensorflow'没有属性'contrib'”

问题描述 投票:0回答:1

我有一个读取CAPTCHA的源代码。运行测试时,我在Windows 10上遇到问题

Traceback (most recent call last):
  File "train.py", line 48, in <module>
    from object_detection.builders import dataset_builder
  File "C:\Users\HuyHys\Anaconda3\lib\site-packages\object_detection\builders\dataset_builder.py", line 27, in <module>
    from object_detection.data_decoders import tf_example_decoder
  File "C:\Users\HuyHys\Anaconda3\lib\site-packages\object_detection\data_decoders\tf_example_decoder.py", line 27, in <module>
    slim_example_decoder = tf.contrib.slim.tfexample_decoder
AttributeError: module 'tensorflow' has no attribute 'contrib'

我发现了一个关于stackoverflow的问题(访问Module 'tensorflow' has no attribute 'contrib'

但是我无法解决此错误。请任何人可以帮助我!如何解决此错误的详细信息???

我有一个读取CAPTCHA的源代码。当我运行测试时,我在Windows 10追溯(最近一次呼叫最近)上遇到问题:文件“ train.py”,第48行,位于from object_detection.builders ...

python-3.x tensorflow object-detection-api
1个回答
1
投票

发生此错误是因为tf.contrib已从TensorFlow 2中删除。我想您正在使用的Tensorflow 1中的旧代码与新的Tenserflow 2不兼容。有关更多信息,请参见Migrate your TensorFlow 1 code to TensorFlow 2。如果您需要更多帮助,请共享所有使用tf.contrib的代码段。

© www.soinside.com 2019 - 2024. All rights reserved.