1、首先下载anaconda,下载:Anaconda2-4.3.1-Linux-x86_64.sh(https://repo.continuum.io/archive/)参考网址:https://www.cnblogs.com/willnote/p/6746499.htmlhtml
2、安装anaconda,进入下载目录python
若是没有修改的话,默认的下载目录是在 /home/下载/下,Ctrl+Alt+T打开终端,输入 cd /home,而后按两次Tab键,终端会自动补上用户名以及该用户名下的文件目录:linux
能够看到排列出的全部文件夹,继续输入 cd/home/dcrmg/下载 ,进入下载目录:windows
三. 安装Anacondaapi
下载的文件是以 .sh 为后缀的,名称比较长,我这里先给它给更名称为 Anaconda.sh。bash
在终端继续输入 sudo bash Anaconda.sh ,开始执行Anaconda安装。工具
会要求先输入用户密码,而后是许可文件,直接按Enter继续:this
接受许可,输入yes,按回车:google
提示默认安装路径是 /home/dcrmg/anaconda2 ,按回车确认,开始安装:url
四. 添加环境变量
安装完成以后,会提示是否添加环境变量,输入 yes 后回车:
这样Anaconda安装成功了。终端窗口提示要使环境变量生效,须要从新打开一个终端。在一个新开的终端里输入python,提示信息显示已经不是Linux系统自带的python了:
或者也能够在当前的终端里让刚配置的环境变量生效,方法是在安装Anaconda的终端中输入:
source ~/.bashrc
5、打开jupyter notebook
在终端输入jupyter notebook便可,以下图:
官方下载更新工具包的速度很慢,因此继续添加清华大学 TUNA提供的Anaconda仓库镜像,在终端或cmd中输入以下命令进行添加
1
2
|
$ conda config
-
-
add channels https:
/
/
mirrors.tuna.tsinghua.edu.cn
/
anaconda
/
pkgs
/
free
/
$ conda config
-
-
set
show_channel_urls yes
|
备注:若是出现conda命令未找到,查看:https://www.cnblogs.com/chamie/p/10009193.html
在终端或cmd中输入如下命令搜索当前可用的tensorflow版本
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
(能够略掉)$ anaconda search
-
t conda tensorflow
Using Anaconda API: https:
/
/
api.anaconda.org
Run
'anaconda show <USER/PACKAGE>'
to get more details:
Packages:
Name | Version | Package Types | Platforms
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
-
-
-
-
-
-
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
HCC
/
tensorflow |
1.0
.
0
| conda | linux
-
64
HCC
/
tensorflow
-
cpucompat |
1.0
.
0
| conda | linux
-
64
HCC
/
tensorflow
-
fma |
1.0
.
0
| conda | linux
-
64
SentientPrime
/
tensorflow |
0.6
.
0
| conda | osx
-
64
: TensorFlow helps the tensors flow
acellera
/
tensorflow
-
cuda |
0.12
.
1
| conda | linux
-
64
anaconda
/
tensorflow |
1.0
.
1
| conda | linux
-
64
anaconda
/
tensorflow
-
gpu |
1.0
.
1
| conda | linux
-
64
conda
-
forge
/
tensorflow |
1.0
.
0
| conda | linux
-
64
, win
-
64
, osx
-
64
: TensorFlow helps the tensors flow
creditx
/
tensorflow |
0.9
.
0
| conda | linux
-
64
: TensorFlow helps the tensors flow
derickl
/
tensorflow |
0.12
.
1
| conda | osx
-
64
dhirschfeld
/
tensorflow |
0.12
.
0rc0
| conda | win
-
64
dseuss
/
tensorflow | | conda | osx
-
64
guyanhua
/
tensorflow |
1.0
.
0
| conda | linux
-
64
ijstokes
/
tensorflow |
2017.03
.
03.1349
| conda, ipynb | linux
-
64
jjh_cio_testing
/
tensorflow |
1.0
.
1
| conda | linux
-
64
jjh_cio_testing
/
tensorflow
-
gpu |
1.0
.
1
| conda | linux
-
64
jjh_ppc64le
/
tensorflow |
1.0
.
1
| conda | linux
-
ppc64le
jjh_ppc64le
/
tensorflow
-
gpu |
1.0
.
1
| conda | linux
-
ppc64le
jjhelmus
/
tensorflow |
0.12
.
0rc0
| conda, pypi | linux
-
64
, osx
-
64
: TensorFlow helps the tensors flow
jjhelmus
/
tensorflow
-
gpu |
1.0
.
1
| conda | linux
-
64
kevin
-
keraudren
/
tensorflow |
0.9
.
0
| conda | linux
-
64
lcls
-
rhel7
/
tensorflow |
0.12
.
1
| conda | linux
-
64
marta
-
sd
/
tensorflow |
1.0
.
1
| conda | linux
-
64
: TensorFlow helps the tensors flow
memex
/
tensorflow |
0.5
.
0
| conda | linux
-
64
, osx
-
64
: TensorFlow helps the tensors flow
mhworth
/
tensorflow |
0.7
.
1
| conda | osx
-
64
: TensorFlow helps the tensors flow
miovision
/
tensorflow |
0.10
.
0.gpu
| conda | linux
-
64
, osx
-
64
msarahan
/
tensorflow |
1.0
.
0rc2
| conda | linux
-
64
mutirri
/
tensorflow |
0.10
.
0rc0
| conda | linux
-
64
mwojcikowski
/
tensorflow |
1.0
.
1
| conda | linux
-
64
rdonnelly
/
tensorflow |
0.9
.
0
| conda | linux
-
64
rdonnellyr
/
r
-
tensorflow |
0.4
.
0
| conda | osx
-
64
test_org_002
/
tensorflow |
0.10
.
0rc0
| conda |
Found
32
packages
|
选择一个较新的CPU或GPU版本,如jjh_cio_testing/tensorflow-gpu的1.0.1版本,输入以下命令查询安装命令
1
2
3
4
5
6
7
8
9
10
11
12
|
(能够略掉)$ anaconda show jjh_cio_testing
/
tensorflow
-
gpu
Using Anaconda API: https:
/
/
api.anaconda.org
Name: tensorflow
-
gpu
Summary:
Access: public
Package Types: conda
Versions:
+
1.0
.
1
To install this package with conda run:
conda install
-
-
channel https:
/
/
conda.anaconda.org
/
jjh_cio_testing tensorflow
-
gpu
|
使用最后一行的提示命令进行安装
1
2
3
4
5
6
7
8
9
10
11
12
|
$ conda install
-
-
channel https:
/
/
conda.anaconda.org
/
jjh_cio_testing tensorflow
-
gpu
=
=
1.3
.
0
Fetching package metadata .............
Solving package specifications: .
Package plan
for
installation
in
environment
/
home
/
will
/
anaconda2:
The following packages will be SUPERSEDED by a higher
-
priority channel:
tensorflow
-
gpu:
1.0
.
1
-
py27_4 https:
/
/
mirrors.tuna.tsinghua.edu.cn
/
anaconda
/
pkgs
/
free
-
-
>
1.0
.
1
-
py27_4 jjh_cio_testing
Proceed ([y]
/
n)?
|
conda会自动检测安装此版本的Tensorflow所依赖的库,若是你的Anaconda缺乏这些依赖库,会提示你安装。由于我以前已经安装过了,因此这里只提示我安装Tensorflow。输入y并回车以后等待安装结束便可
进入python,输入
1
|
import
tensorflow as tf
|
若是没有报错说明安装成功。
安装完CUDA 8 和 cuDNN 5后, 在终端输入 sudo apt-get install libcupti-dev(参考:https://www.cnblogs.com/zengcv/p/6564517.html)
Ubuntu14.04默认安装的Python2.7.6
先安装Python库
1
|
sudo apt
-
get install python
-
pip python
-
dev
|
安装tensorflow:
(1)在线安装
sudo pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.1-cp27-none-linux_x86_64.whl
(2)下载安装(因为Ubuntu系统下,网上比较慢,能够在windows下载。推荐这种安装方法)
sudo pip install tensorflow_gpu-1.0.1-cp27-none-linux_x86_64.whl
(下载地址:https://pypi.org/project/tensorflow-gpu/1.0.1/#files)
参考文献: