如何修复AttributeError:module';tensorflow';没有属性';凯拉斯';?
我遵循基本的tensorflow教程(识别28x28像素的手写数字0-9),但当我运行以下两行时:如何修复AttributeError:module';tensorflow';没有属性';凯拉斯';?,tensorflow,module,keras,attributes,attributeerror,Tensorflow,Module,Keras,Attributes,Attributeerror,我遵循基本的tensorflow教程(识别28x28像素的手写数字0-9),但当我运行以下两行时: import tensorflow as tf mnist = tf.keras.datasets.mnist 我收到了错误信息 AttributeError:模块“tensorflow”没有属性“keras” 我看过一些有类似问题的帖子,看起来答案通常是更新你的tensorflow和keras版本,但我想我已经这么做了,这个错误信息还在出现。我怎样才能解决这个问题?我想你有打字错误。 应更改
import tensorflow as tf
mnist = tf.keras.datasets.mnist
我收到了错误信息
AttributeError:模块“tensorflow”没有属性“keras”
我看过一些有类似问题的帖子,看起来答案通常是更新你的tensorflow和keras版本,但我想我已经这么做了,这个错误信息还在出现。我怎样才能解决这个问题?我想你有打字错误。 应更改此行:
mnist=tf.kera.datasets.mnist
致:
mnist=tf.keras.datasets.mnist
请注意,我将
kera
更改为keras
哦,那是我的错!我刚刚修复了这个问题,现在它给了我同样的错误(但是这次使用'keras':“AttributeError:module'tensorflow'没有'keras'属性”您的tensorflow版本是什么?您可以使用此方法进行检查:您可能想查看您的文件名。我仔细查看了所有内容,以找到导致它的原因,结果发现我将我的文件命名为tensorflow.py或tensorboard.py。通常不要将您的文件命名为tensorflow.py或tensorboard.py或任何其他模块名称