1.激活virtualenv环境:
localhost% pwd
/Users/wangmingqiang/tf-course
localhost% cd ~/tf-course
localhost% source venv/bin/activate
2.进入python环境
(venv) localhost% python
>>> import tensorflow as tf
#定义产量操作 hello
>>> hello = tf.constant("hello Tensorflow")
#创建一个会话
>>>sess = tf.Session()
#执行产量操作 hello 并打印到标准输出
>>>print(sess.run(hello))
网友评论