1.禁用v2,修改import tensorflow as tf为 import tensorflow._api.v2.compat.v1 as tf tf.disable_v2_behavior() 2.