TensorFlow +Ubuntu配置方法

 TensorFlow+Ubuntu 配置方法


参考自:http://www.leiphone.com/news/201606/ORlQ7uK3TIW8xVGF.html


TensorFlow 地址:https://www.tensorflow.org/

TensorFlow (r0.11版)下载和配置说明:https://www.tensorflow.org/versions/r0.11/get_started/os_setup.html


1、环境

Ubuntu:Ubuntu16.04.2-desktop-amd64.iso(64位系统)

Python:2.7.12

查看系统自带Python版本信息:

命令:$python --version


2、安装步骤

(1)Pip Installation(Pip安装)

# Ubuntu/Linux 64-bit
命令:$ sudo apt install python-pip python-dev

注意:命令不再是$ sudo apt-get install python-pip python-dev,否则会报错


(2)Then, select the correct binary to install(选择正确的二进制包安装):

# Ubuntu/Linux 64-bit, CPU only, Python 2.7
$
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl


安装命令为:

$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl

执行命令后报错:



报错的意思:使用的pip版本为8.1.1,但是要求9.0.1版本。

那就升级呗。

升级命令:$pip install --upgrade pip


再次执行下面的命令:

$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl

不再报错。




终于配置成功了。

3、实例实验

打开python命令行:

	import tensorflow as tf
	hello=tf.constant('hello,tensorflow')
	sess=tf.Session()
	print sess.run(hello)
输出结果为:hello,tensorflow
	a=tf.constant(20)
	b=tf.constant(40)
	print sess.run(a+b)
输出结果为:60


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值