TensorFlow安装与测试
TensorFlow官网:http://tensorflow.org/
安装步骤:
1、sudo apt-get install Python-pip python-dev python-virtualenv
2、virtualenv –system-site-packages ~/tensorflow
3、cd ~/tensorflow
4、source bin/activate # If using bash
5、(tensorflow)$ pip install –upgrade tensorflow-0.5.0-cp27-none-linux_x86_64.whl
测试:
1、打开终端输入cd tensorflow
2、source bin/activate
3、python
4、输入python后输入以下示例
>>> import tensorflow as tf
>>> hello = tf.constant(‘Hello, TensorFlow!’)
>>> sess = tf.Session()
>>> print sess.run(hello)
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print sess.run(a+b)
42
>>>
5、测试成功接下来首先退出python 按快捷键Ctrl+D
6、再退出tensorflow 在命令行输入命令:deactivate
本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-08/134547.htm