【问题标题】:No module named 'tensorflow.contrib' while importing tflearn导入 tflearn 时没有名为“tensorflow.contrib”的模块
【发布时间】:2020-02-09 07:56:20
【问题描述】:

我在导入 tflearn 时遇到了这个错误:-

导入 tflearn

Traceback(最近一次调用最后一次): 文件“”,第 1 行,在 文件“/Users/rohansethi/anaconda3/lib/python3.7/site-packages/tflearn/init.py”,第 4 行,在 从 。导入配置 文件“/Users/rohansethi/anaconda3/lib/python3.7/site-packages/tflearn/config.py”,第 5 行,在 从 .variables 导入变量 文件“/Users/rohansethi/anaconda3/lib/python3.7/site-packages/tflearn/variables.py”,第 7 行,在 从 tensorflow.contrib.framework.python.ops 导入 add_arg_scope 作为 contrib_add_arg_scope ModuleNotFoundError: 没有名为“tensorflow.contrib”的模块

【问题讨论】:

  • 你用的是哪个tf版本?

标签: tensorflow tflearn


【解决方案1】:

您需要使用旧版本的 TensorFlow。

tensorflow.contrib

已从 tensorflow 中删除,版本 >=1.14。

这是你可以做的:

pip uninstall tensorflow
pip install tensorflow==1.14

检查一切是否正常: 在控制台输入python 启动python 然后:

import tensorflow
tensorflow.__version__

它应该显示 1.14。 现在你可以运行你的程序了。

【讨论】:

  • 问题已修复。但又遇到了一个问题。 ModuleNotFoundError:没有名为“tensorflow.contrib.eager”的模块。你能帮忙吗?
猜你喜欢
  • 1970-01-01
  • 2020-07-13
  • 1970-01-01
  • 1970-01-01
  • 2016-12-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-07-07
相关资源
最近更新 更多