tensorflow - 属性错误 : module 'tensorflow' has no attribute 'Session'

标签 tensorflow python-3.6

当我调用python3.6中的任何函数时,出现以下错误;然而,它在 python3.4 中运行良好。任何的想法? 将tensorflow导入为tf tf.Session() 追溯(最近一次通话): 文件“”,第 1 行,位于 AttributeError: 模块 'tensorflow' 没有属性 'Session'

Here is my System information

  • 操作系统平台和发行版(例如,Linux Ubuntu 16.04):Debian 8.7
  • TensorFlow 安装自(源代码或二进制文件):通过 pip3
  • TensorFlow 版本(使用下面的命令):1.7.0
  • Python版本:3.6.5
  • CUDA/cuDNN版本:cuda 9.0和cudnn 7.0
  • GPU型号和内存:K80,12GB
  • 重现的确切命令: 将 tensorflow 导入为 tf tf.Session()

最佳答案

我也遇到了这个问题。 重新安装 TensorFlow 解决了我的问题。

  pip uninstall tensorflow-gpu
  pip install tensorflow-gpu

关于tensorflow - 属性错误 : module 'tensorflow' has no attribute 'Session' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49846106/

相关文章:

python - 如何有条件地将值分配给张量[损失函数的掩蔽]?

python - Keras:收集张量改变批量维度

python - 比较 2 个 csv 文件之间的列并使用 Python 写入差异

tensorflow - tf.Dataset.from_tensor_slices性能问题

python - 命名自定义层中层的权重

Python 无法将 tensorflow 导入 Mac OS X 10.8

cookies - Cookie 错误 : Illegal Key

python - 使用 python 3.6 异步的 UDP 代理服务器

python - 委托(delegate)给 python 3.6+ asyncio 协程中的生成器

python - 当通过命令行执行时,导入日期时间会在 Python 脚本中引发 ModuleNotFound 'math'