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

AttributeError: 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. python脚本AttributeError: module 'xxxx' has no attribute 'xxxxx'错误解决办法

    最近写脚本发现了这样的一个错误,脚本.环境什么的完全正确,但执行的时候却报错:AttributeError: module 'xxxx' has no attribute 'xxxxx',查阅了一些相 ...

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

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

  6. PyQt5系列(三)Python3.x AttributeError: module 'string' has no attribute 'maketrans'错误解决

    解决: 1./usr/local/lib/python3.6/site-packages/PyQt5/uic/port_v2/ascii_upper.py修改  _ascii_trans_table ...

  7. module 'tensorflow' has no attribute 'Session'

    AttributeError: module 'tensorflow' has no attribute 'Session'错误解决 原创陆羽飞 最后发布于2019-10-07 13:32:07 阅读 ...

  8. TensorFlow报AttributeError: module tensorflow has no attribute io

    错误描述 在使用TensorFlow的models参考的代码训练目标检测模型时候报AttributeError: module 'tensorflow' has no attribute 'io'错误 ...

  9. tensorflow版本问题导致的错误AttributeError: module ‘tensorflow‘ has no attribute ‘***‘

    问题解决--AttributeError: module 'tensorflow' has no attribute 'placeholder' - yuanyuanWu11 - 博客园 tensor ...

最新文章

  1. 推荐8款堪称神器的良心软件
  2. python入门教程 官方-Pytest官方教程-01-安装及入门
  3. 棋盘问题 简单搜索DFS
  4. docker-compose 报错记录
  5. .net快速入门方法,转csdn
  6. 被曝大裁员,涉及30%员工!公司内斗、高管之间拉帮结派 喜茶回应了...
  7. LinkedIn庄振运:从国家部委公务员到硅谷系统性能专家,创新是唯一主旋律
  8. NSGA2算法原理及python实现
  9. 中国无线充电行业发展规模与投资可行性咨询报告2022-2027年版
  10. WDM驱动开发 电源管理
  11. 51单片机的交流电流检测系统设计(程序+原理图+PCB)
  12. QQ快速登录协议的分析与漏洞利用
  13. mysql 公历变农历_巧用SQL函数让公历变农历
  14. C04-算法达人修炼营学习安排及方法指导
  15. php基础练习题,PHP基础开发试题题目及答案,课程2020最新期末考试题库,章节测验答案...
  16. router禁用443端口
  17. C语言中调用数组元素的三种方法:下标法、数组名法、指针法
  18. 有关《家》的经典歌曲_浅谈艺术歌曲《家》的演唱
  19. jpg转bmp(使用libjpeg)
  20. 启蒙、亲情、乐趣、营养,“健康童乐园”全面支持乡村儿童成长

热门文章

  1. 为什么css放头部、js放尾部
  2. Java IO框架之BIO、NIO、AIO
  3. c语言键盘驱动程序,c语言键盘扫描程序
  4. 【分享】面试官:简单表述怎么做接口测试
  5. fgets函数的使用
  6. 基于单片机智能波形发生器设计
  7. Win10安装程序报错2503和2502错误解决方案
  8. SystemUI(一)基于Android9.0SystemUI的启动与定制化
  9. Sqli-labs 基本注入篇 (Less1~22)
  10. PowerPoint 教程:如何在 PowerPoint 中从大纲创建演示文稿?