手机版
你好,游客 登录 注册
背景:
阅读新闻

TensorFlow安装与测试

[日期:2016-08-24] 来源:Linux社区  作者:mydebug [字体: ]

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

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款