AttributeError: 模块“tensorflow"在 Keras 中没有属性“name_scope" [英] AttributeError: module 'tensorflow' has no attribute 'name_scope' with Keras
本文介绍了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屋!
查看全文