【问题标题】:importing tflearn - No module named 'tensorflow.contrib.framework'导入 tflearn - 没有名为“tensorflow.contrib.framework”的模块
【发布时间】:2019-08-24 18:22:32
【问题描述】:

然后我输入 import tflearn 我得到了下面的错误,我按照这里的指南操作:https://www.youtube.com/watch?v=ViO56ASqeks

我可以使用 tflearn 做什么,还是应该使用其他代码?

我收到以下错误。

import tflearn
  File "/usr/local/lib/python3.5/dist-packages/tflearn/__init__.py", line 4, in <module>
    from . import config
  File "/usr/local/lib/python3.5/dist-packages/tflearn/config.py", line 5, in <module>
    from .variables import variable
  File "/usr/local/lib/python3.5/dist-packages/tflearn/variables.py", line 7, in <module>
    from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope
ImportError: No module named 'tensorflow.contrib.framework

有人可以帮我吗?

20/08-2019:编辑 20.35 点子列表:

张量流 2.0.0rc0

【问题讨论】:

    标签: python tflearn


    【解决方案1】:

    我遇到了类似的问题,我通过以下方式解决了它:-

    1) 将 python 升级到 3.6
    2) pip 卸载 tflearn
    3) pip install git+https://github.com/tflearn/tflearn.git
    4)正如另一个解决方案中建议的那样,tensorflow 2.0.0 不支持 tflearn 所以我安装了 tensorflow==1.14.0

    我在这里找到了解决方案:- Issue Link/

    【讨论】:

    • 我一直在寻找 5 个多小时的解决方案仍然没有得到,但最终我在这里得到了答案。
    【解决方案2】:

    如果您使用 conda 环境(不仅如此,而且我建议您使用它),那么解决方案将是使用较低版本的 tensorflow pip uninstall tensorflow pip install tensorflow==1.14.0

    并且可以使用脚本修复所有错误(我在降级tf之前使用它):

    tf_upgrade_v2 \
      --intree my_project/ \
      --outtree my_project_v2/ \
      --reportfile report.txt
    

    对我有用

    【讨论】:

      【解决方案3】:

      您需要先安装 tensorflow,然后才能使用 tflearn。 来自tflearngithub页面:

      TensorFlow 安装
      TFLearn 需要安装 Tensorflow(1.0+ 版本)。

      安装张量流:

      pip install tensorflow
      

      【讨论】:

        【解决方案4】:

        你看的教程用的是tensorflow 0.9版什么的,当前版本是2.0。本教程已有 3 年 的历史。您应该观看更新的视频。

        不过,你可以试试。

        pip install tensorflow==1.0
        pip install tflearn
        

        如果您使用的是虚拟环境,请确保您已激活它。

        【讨论】:

          【解决方案5】:

          您可以使用keras 代替tflearn

          tensorflow.contrib 在 2.0 版本中被移除,因此您需要版本 see here)。

          【讨论】:

            猜你喜欢
            • 2020-02-09
            • 2016-12-30
            • 1970-01-01
            • 2019-10-19
            • 2014-05-29
            • 2021-05-16
            • 2019-04-12
            • 1970-01-01
            • 2019-11-21
            相关资源
            最近更新 更多