解决tensorflow版本问题(tf2使用tf1的库函数) 可以将: import tensorflow as tf 改为: import tensorflow.compat.v1 as tf tf.disable_v2_behavior() 即可解决