Ubuntu 18.04安装Tensorflow(CPU)

最近我开始学习深度学习框架Tensorflow,一开始在Windows平台下的anaconda下安装,由于anaconda安装几次后navigator打开老是出现闪退的问题,所以决定换个Ubuntu下继续折腾tensorflow。本人笔记本没有NVIDIA显卡,只装的CPU版本的。而且是在虚拟机下的,下面开始吧。

先安装好Ubuntu 18.04版本的系统(最好是Ubuntu的14.04版本以上),Ubuntu系统已经有了了Python 3.7.7.7,所以不需要再安装Python了。

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

(1)备份当前也就是默认官方的源列表

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

(2)删除sources.list文件中的列表,删除全部内容

sudo gedit /etc/apt/sources.list1

(3)替换内容后,保存

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

4)更新源列表

sudo apt-get update

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

(1)安装Python3的包管理pip

sudo apt-get install python3-pip python3-dev

Ubuntu 18.04安装Tensorflow(CPU)

(2)安装tensorflow

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

Ubuntu 18.04安装Tensorflow(CPU)

(3)测试tensorflow

Ubuntu 18.04安装Tensorflow(CPU)

相关推荐