运行代码一直出现这个错误,是什么原因

Traceback (most recent call last):
File "C:/Users/SKY/AppData/Roaming/JetBrains/PyCharmCE2021.2/scratches/scratch_6.py", line 59, in
y_hat = mymodel(x_input)
File "C:/Users/SKY/AppData/Roaming/JetBrains/PyCharmCE2021.2/scratches/scratch_6.py", line 21, in mymodel
layer1 = tf.layers.conv2d(inputs,3,kernel_size = (10,10), activation=tf.nn.relu)#卷积层
AttributeError: module 'tensorflow' has no attribute 'layers'
(64, 80, 80, 1)

安装tensorflow 1.0以上的版本。

题主可以看看创建的包或者文件有没有和tensorflow重名的,有重名的也会导致引用不成功