AttributeError: module 'tensorflow' has no attribute 'Session'错误解决
原创陆羽飞 最后发布于2019-10-07 13:32:07 阅读数 16728  收藏
展开
Ubuntu刚安装好Tensorflow以后运行

import tensorflow as tf
tf.Session()
报错AttributeError: module 'tensorflow' has no attribute 'Session'。这其实不是安装错误,是因为在新的Tensorflow 2.0版本中已经移除了Session这一模块,改换运行代码

tf.compat.v1.Session()
就可以获得与原先相同的输出信息。如果觉得不方便,也可以改换低版本的Tensorflow,直接用pip即可安装

sudo pip install tensorflow==1.14

module 'tensorflow' has no attribute 'Session'相关推荐

  1. AttributeError: module ‘tensorflow‘ has no attribute ‘Session‘错误解决

    AttributeError: module 'tensorflow' has no attribute 'Session'错误解决 根据网上教程安装tensorflow环境时,最后都会有个测试代码用 ...

  2. tensorflow2.0及以上版本在使用Session模块时报错:AttributeError: module ‘tensorflow‘ has no attribute ‘Session‘ 已解决

    tensorflow2.0版本及之后的版本在使用Session模块时报错:AttributeError: module 'tensorflow' has no attribute 'Session' ...

  3. AttributeError: module 'tensorflow' has no attribute 'Session'.解决办法

    # 定义计算图 tens1 = tf.constant([1,2,3])# 创建一个会话 sess = tf.Session()# 使用这个创建好的会话来得到关心的运算的结果.比如可以调用 sess. ...

  4. AttributeError: module 'tensorflow' has no attribute 'Session'错误解决

    Ubuntu刚安装好Tensorflow以后运行 import tensorflow as tf tf.Session() 报错AttributeError: module 'tensorflow' ...

  5. AttributeError: module 'tensorflow' has no attribute 'Session'

    tf.Session()是旧版本的语法,如果要跑,加入下面代码 https://github.com/tensorflow/tensorflow/issues/34658 import tensorf ...

  6. module ‘tensorflow‘ has no attribute xxx tensorflow版本问题类导致API函数的报错

    目录 1. module 'tensorflow' has no attribute 'Session' 2. The Session graph is empty. Add operations t ...

  7. module ‘tensorflow‘ has no attribute ‘Tensor‘

    module 'tensorflow' has no attribute 'Tensor' import tensorflow as tftf.compat.v1.Session()from typi ...

  8. AttributeError: module 'tensorflow' has no attribute 'random_normal'

    执行<TensorFlow实战Google深度学习框架(第2版)>only源代码 CH3 时如下语句报错 batch_size = 8 w1= tf.Variable(tf.random_ ...

  9. tf2.0环境下“module ‘tensorflow‘ has no attribute ‘log‘”的解决办法

    写在这里的初衷,一是备忘,二是希望得到高人指点,三是希望能遇到志同道合的朋友. 目录 一.问题 二.根本原因 三.解决办法 方法一 方法二 一.问题 目前,尝试着通过tensorflow对医学图像进行 ...

最新文章

  1. matlab如何截取图像的中间部分_利用matlab提取并分割RGB图像中的某一个已知像素值的图像...
  2. Tomcat 跨域问题的解决
  3. 单线程下的生产者--消费者模式详解,wait和sleep的区别
  4. 编写干净的测试–从配置开始
  5. c语言中二维数组的结构体,怎么才能把结构体里面的二维数组打印出来?
  6. Android之Fragment(二)
  7. 红橙Darren视频笔记 IOC注解框架 了解xUtils3与ButterKnife的原理
  8. “我有必要写技术博客吗?” 写技术博客一年,谈谈其得失优劣
  9. VSCode调试Python时终端输出中文乱码解决方法2
  10. CICD详解(六)——SVN+Jenkins项目控制实战
  11. XmlDataProvider的简单应用
  12. 如何使用@PostConstruct初始化敏感词库和hutool过滤敏感词信息
  13. 环境管理体系ISO14001认证常见的审核问题有哪些?
  14. 数据分析最常用的excel函数公式大全
  15. python数据拟合方法_Python-最小二乘法曲线拟合
  16. 计算机考研专业课靠什么,2021计算机考研:这4个科目 各科该如何备考?
  17. 既生左,何生曾——曾国藩与左宗棠一生恩怨考
  18. 最小生成树(Minimum Spanning Tree)
  19. c语言卸载了软件打不开了,控制面板卸载不了程序,手把手教你如何处理控制面板中卸载不掉的软件...
  20. 中心商务区建智慧城市 将现 “芝加哥夜景”

热门文章

  1. 安装 Windows8 后值得做的十多项简单优化,让Win8速度快上加快!
  2. 什么是ATL? (与COM的关系,及MFC与COM的关系)
  3. (六)OpenStack---M版---双节点搭建---Neutron安装和配置
  4. Makefile之大型工程项目子目录Makefile的一种通用写法
  5. python数据存储与读取_【Python爬虫】数据保存与读取
  6. 算法 - 选择排序(C#)
  7. php oracle count,调用Count列php mysql
  8. mqtt协议视频教程_MQTT协议教程
  9. 基于python爬虫的岗位数据分析以拉勾网为例_Python拉勾爬虫——以深圳地区数据分析师为例...
  10. mysql 大写 小写_Mysql大小写敏感的问题