Ubuntu下安装Tensorflow(CPU)

Ubuntu下安装Tensorflow(CPU)

一、更新为阿里云软件源,增加下载速度

(1)备份当前也就是默认官方的源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
(2)删除sources.list文件中的列表,删除全部内容
sudo gedit /etc/apt/sources.list
(3)替换内容后,保存
deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

更改软件源

(4)更新源列表
sudo apt-get update

二、安装Tensorflow(Python3.5.2/CPU)

(1)安装Python3的包管理pip
sudo apt-get install python3-pip python3-dev

安装python

(2)安装tensorflow

(自动安装相关库numpy、tensorboard、six、protobuf、html5lib、bleach、werkzeug、markdown)

sudo pip3 install tensorflow

安装tensorflow

(3)测试tensorflow
import tensorflow as tf
a = tf.constant(1)
b = tf.constant(2)
op = a + b
sess = tf.Session()
sess.run(op)
sess.close()

测试

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值