AttributeError: module 'tensorflow' has no attribute 'placeholder'等问题的解决

查看tf版本。
我的是因为在tf2下使用了tf1的API。
解决方式:
使用
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
替换
import tensorflow as tf