错误描述 AttributeError: module 'tensorflow' has no attribute 'Session' 因为代码是tf1.0的,而你用的环境是tf2.0的 所以,两种解决方法 方法一 import tensorflow.compat.v1 as tf 方法二 或者在tf和函数之间加上compat.v1 tf.compat.v1.Session() 第二种方法比较麻烦。