问题一
因为下载的tensorflow为2.0 但在Tensorflow 2.0 环境中使用 tf.compat.v1.Session 而不是使用 tf.Session()。
问题二
法执行sess.run()的原因是tensorflow版本不同导致的,tensorflow版本2.0无法兼容版本1.0.
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
hello = tf.constant('Hello, TensorFlow!')
sess = tf.compat.v1.Session()
print(sess.run(hello))