Tensorflow 2.0 - AttributeError:模块'tensorflow'没有属性'Session'

发布于 2022-07-28 22:54:50

当我sess = tf.Session()在 Tensorflow 2.0 环境中执行命令时,我收到如下错误消息:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute 'Session'

系统信息:

  • 操作系统平台和发行版:Windows 10
  • Python版本:3.7.1
  • Tensorflow 版本:2.0.0-alpha0(用 pip 安装)

重现步骤:

安装:

  1. 点安装——升级点
  2. pip install tensorflow==2.0.0-alpha0
  3. 点安装 keras
  4. pip install numpy==1.16.2

执行:

  1. 执行命令:import tensorflow as tf
  2. 执行命令:sess = tf.Session()
关注者
0
被浏览
25
1 个回答
知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看