AttributeError:模块“tensorflow”没有属性“InteractiveSession”

新手上路,请多包涵

我已经在 Ubuntu 16.10 环境中从 Source 安装了 tensorflow。一切顺利,但现在在编译程序时,它显示以下错误:

 Traceback (most recent call last):
  File "ff.py", line 3, in <module>
    sess = tf.InteractiveSession()
AttributeError: module 'tensorflow' has no attribute 'InteractiveSession'

没有找到与此相关的帖子。有人可以帮忙吗?

原文由 Saurav– 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 708
1 个回答
sess=tf.compat.v1.InteractiveSession()

如果您使用的是 tesorflow 2.0.0 版本,请使用上面的行而不是 sess = tf.InteractiveSession()

原文由 Risith Ratan Patra 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题