打印helloworld
在我們安裝好python virtuanlenv tensorflow後
進入虛擬環境:
.\Scripts\active
運行python,輸入以下語句
>>>import tensorflow as tf
>>>message = tf.constant(‘helloworld’)
>>>with tf.Session as sess
… print(sess.run(message).decode())
回車將打印helloworld
以上代碼的意思是
1.導入tensorflow
2.常量helloworld賦值給message
3.創建Session
4.利用Session的run方法打印message,
ps:decode加上後則去掉p’'標誌