Reprinted: tensorflow shows the solution of "module'tensorflow' has no attribute'placeholder'" [measured successfully]

Just for the record, please skip it.

Solution:

1. Check the version of tensorflow:

import tensorflow as tf  #载入tensorflow环境

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

If it is version 2.

2. Change "import tensorflow as tf" to

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

Portal
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_41529093/article/details/112999399