AttributeError:模块"tensorflow"不具有Keras属性"name_scope" [英] AttributeError: module 'tensorflow' has no attribute 'name_scope' with Keras

查看:790
本文介绍了AttributeError:模块"tensorflow"不具有Keras属性"name_scope"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行脚本,但是在导入方面我已经很挣扎了. 这次导入

I am trying to run a script, but I struggle already at the imports. This import

from keras.preprocessing.image import save_img

引发以下错误:

AttributeError: module 'tensorflow' has no attribute 'name_scope'.

我正在使用以下软件包.

I am using the following packages.

Keras                     2.2.2,                     
Keras-Applications        1.0.4,                   
Keras-Preprocessing       1.0.2,                   
tensorflow                1.9.0,                     
tensorflow-gpu            1.9.0                

推荐答案

我无法使用相同版本的keras和tensorflow进行复制,请重新安装keras和tensorflow,可能会解决此问题,请使用以下命令:

I was unable to reproduce with the same versions of the keras and tensorflow, reinstalling keras and tensorflow, may solve the issue, please use commands below:

pip install --upgrade pip setuptools wheel
pip install -I tensorflow
pip install -I keras

注意:-I参数代表忽略已安装的软件包.

NOTE: The -I parameter stands for ignore installed package.

这篇关于AttributeError:模块"tensorflow"不具有Keras属性"name_scope"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆