转载:tensorflow显示“module ‘tensorflow‘ has no attribute ‘placeholder‘”的解决【实测成功】

仅作为记录,大佬请跳过。

解决方法:

1、查看tensorflow的版本:

import tensorflow as tf  #载入tensorflow环境

print(tf.__version__)    #查看tensorflow版本

如果是版本2.几,

2、则将“import tensorflow as tf”改为

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

传送门
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_41529093/article/details/112999399