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)
參考文獻: