入门萌新,若有错误望大佬给予指出,谢谢!
一、AttributeError: module ‘tensorflow’ has no attribute ‘flags’
- 在我的code中是由该命令
FLAGS = tf.flags.FLAGS
引起的报错,主要原因是我下载的tensorflow是最新的版本2.1,将tensorflow修改为1.9版本即可。 - 第二种方法,在tensorflow官方在线文档搜索
tf.flags
,通过观看下图可以看出flags模块已经移至compat.v1中,原命令修改为FLAGS = tf.compat.v1.flags.FLAGS
即可。
二、AttributeError: module ‘tensorflow.python.keras.backend’ has no attribute ‘get_graph’
出错原因:keras、tensorflow版本不兼容,更改其中之一的版本。