导入keras报错:module 'tensorflow.python.keras.backend' has no attribute 'get_graph'

这篇博客主要讨论了在导入Keras时遇到的'get_graph'属性缺失错误,原因是Tensorflow版本与Keras版本不匹配。文章提到了FloydHub支持的Deep Learning环境,这些环境中预装了不同版本的Python、Keras和Tensorflow。在没有指定环境时,默认使用Python 3.6、Keras 2.2.0和Tensorflow 1.9.0的环境,并提供了如何选择CPU或GPU运行Python2 Tensorflow作业的命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

主要是因为tensorflow与keras的版本不兼容

import tensorflow

print(tensorflow.__version__)

 

 

Environments

Below is the list of Deep Learning environments supported by FloydHub. Any of these can be specified in the floyd run command using the --env option.

If no --env is provided, it uses the tensorflow-1.9 image by default, which comes with Python 3.6, Keras 2.2.0 and TensorFlow 1.9.0 pre-installed.

Framework Env name (--env parameter) Description Docker Image Packages and Nvidia Settings
TensorFlow 2.1 tensorflow-2.1 TensorFlow 2.1.0 + Keras 2.3.1 on Python 3.6. floydhub/tensorflow TensorFlow-2.1
TensorFlow 2.0 tensorflow-2.0 TensorFlow 2.0.0 + Keras 2.3.1 on Python 3.6. floydhub/tensorflow TensorFlow-2.0
TensorFlow 1.15 tensorflow-1.15 TensorFlow 1.15.0 + Keras 2.3.1 on Python 3.6. floydhub/tensorflow TensorFlow-1.15
TensorFlow 1.14 tensorflow-1.14 TensorFlow 1.14.0 + Keras 2.2.5 on Python 3.6. floydhub/tensorflow TensorFlow-1.14
TensorFlow 1.13 tensorflow-1.13 TensorFlow 1.13.0 + Keras 2.2.4 on Python 3.6. floydhub/tensorflow TensorFlow-1.13
TensorFlow 1.12 tensorflow-1.12 TensorFlow 1.12.0 + Keras 2.2.4 on Python 3.6. floydhub/tensorflow TensorFlow-1.12
  tensorflow-1.12:py2 TensorFlow 1.12.0 + Keras 2.2.4 on Python 2. floydhub/tensorflow  
TensorFlow 1.11 tensorflow-1.11 TensorFlow 1.11.0 + Keras 2.2.4 on Python 3.6. floydhub/tensorflow
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值