官方指南:https://github.com/tensorflow/tensorflow/blob/master/tensorflow/docs_src/install/install_linux.md#InstallingAnaconda
https://github.com/jtoy/awesome-tensorflow
1.在清華大學 TUNA 鏡像源選擇對應的操作系統與所需的Python版本下載Anaconda安裝包。 bash Anaconda3-5.0.1-Linux-x86_64.sh
在安裝的過程中,會詢問安裝路徑,按回車即可。之后會詢問是否將Anaconda安裝路徑加入到環境變量(.bashrc)中,輸入yes,這樣以后在終端中輸入python即可直接進入Anaconda的Python版本(如果你的系統中之前安裝過Python,自行選擇yes or no)。安裝成功后,會有當前用戶根目錄下生成一個anaconda3的文件夾,里面就是安裝好的內容
查詢安裝信息 $ conda info
查詢當前已經安裝的庫 $conda list
安裝庫(***代表庫名稱)$conda install ***
更新庫$conda update ***
2. 添加清華大學 TUNA提供的Anaconda倉庫鏡像
$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
$ conda config --set show_channel_urls yes
之后會自動在用戶根目錄生成“.condarc”文件,Ubuntu環境下路徑為~/.condarc,Windows環境下路徑為C:\用戶\your_user_name\.condarc
3.安裝
創建環境:$conda create -n tensorflow
激活:$source activate tensorflow
搜索當前可用的tensorflow版本:$ anaconda search -t conda tensorflow
$anaconda show anaconda/tensorflow
$conda install --channel https://conda.anaconda.org/anaconda tensorflow
或者conda install -c anaconda tensorflow
測試:
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
關閉: $source deactivate tensorflow
注:若出現類似The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations這樣的warning,可以通過在終端中輸入export TF_CPP_MIN_LOG_LEVEL=2解決
