gpt4 book ai didi

python - 属性错误 : module 'tensorflow' has no attribute 'name_scope' with Keras

转载 作者:太空宇宙 更新时间:2023-11-03 14:43:11 26 4
gpt4 key购买 nike

我正在尝试运行一个脚本,但我已经在进口方面遇到了困难。这个导入

from keras.preprocessing.image import save_img

引发以下错误:

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

我正在使用以下软件包。

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,可能会解决问题,请使用以下命令:

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

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

关于python - 属性错误 : module 'tensorflow' has no attribute 'name_scope' with Keras,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51724309/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com