在Spyder上实现。
#导入软件包
import tensorflow as tf
#定义常量操作(既可以是字符串,也可以是数字) hello
hello=tf.constant('hello tensorflow')
#创建一个会话(上下文环境)
sess=tf.Session()
#执行常量操作 hello 并打印到标准输出
print(sess.run(hello))
输出:b'hello tensorflow'
说明:学习视频链接https://www.bilibili.com/video/BV194411T7BB?p=11
,这个视频讲解的比较好,从头到尾观看下来,跟着视频实际操作一下,就很容易上手了。