【问题标题】:tflearn with tensorflow 2.0带有张量流 2.0 的 tflearn
【发布时间】:2019-10-12 18:58:43
【问题描述】:

我无法使用 TensorFlow 2.0 导入 tflearn

Python 3.7.4 (v3.7.4:e09359112e, Jul  8 2019, 14:54:52) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
>>> import tflearn
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tflearn/helpers/summarizer.py", line 9, in <module>
    merge_summary = tf.summary.merge
AttributeError: module 'tensorboard.summary._tf.summary' has no attribute 'merge'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import tflearn
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tflearn/__init__.py", line 8, in <module>
    from . import models
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tflearn/models/__init__.py", line 2, in <module>
    from .dnn import DNN
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tflearn/models/dnn.py", line 6, in <module>
    from ..helpers.trainer import Trainer
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tflearn/helpers/__init__.py", line 2, in <module>
    from .evaluator import Evaluator
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tflearn/helpers/evaluator.py", line 9, in <module>
    from .trainer import evaluate_flow
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tflearn/helpers/trainer.py", line 20, in <module>
    from .summarizer import summaries, summarize, summarize_gradients, \
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tflearn/helpers/summarizer.py", line 12, in <module>
    merge_summary = tf.merge_summary
AttributeError: module 'tensorflow' has no attribute 'merge_summary'

谁能帮我解决这个问题? 我真的需要尽快解决。 我对 tensorflow 很陌生。

【问题讨论】:

    标签: python python-3.x tensorflow tflearn


    【解决方案1】:

    截至今天,tflearn (v0.3.2) 尚未准备好 TensorFlow 2.0,特别需要 TF 1.x。我确信它会在某个时候更新,但现在,如果您需要 tflearn,请使用 TF 1。


    我得到一个不同的错误:ModuleNotFoundError: No module named 'tensorflow.contrib',因为contrib 已移至tensorflow_addons,并且pypi package is currently for Linux only


    20 年 12 月更新: v0.5.0(20 年 11 月发布)支持 TF2, exclusively

    注意:最新的 TFLearn (v0.5) 仅与 TensorFlow v2.0 及更高版本兼容。

    并确保正确导入:

    import tflearn
    import tensorflow.compat.v1 as tf
    

    【讨论】:

      猜你喜欢
      • 2021-05-17
      • 1970-01-01
      • 2016-02-19
      • 2016-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-26
      相关资源
      最近更新 更多