Anaconda 安裝包可以到清華 https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 下載可選擇之前的版本。或者https://www.anaconda.com/download/#linux官網(wǎng)下載地址,最新版本。
(https://repo.continuum.io/archive/index.html)這里也有下載地址,可以使用命令下載,如下
wget https://repo.continuum.io/archive/Anaconda3-5.3.0-Linux-x86_64.sh
##這是python3的,可以去上面的鏈接里,找到適合自己系統(tǒng)python版本的,比如
#wget https://repo.continuum.io/archive/Anaconda2-5.3.0-Linux-x86_64.sh
#按照需求自己選
不添加鏡像,或者添加清華鏡像https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/好處是下載快(其實我感覺差不多速度)自行選擇。清華鏡像添加是執(zhí)行下面幾句
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
然后執(zhí)行
bash Anaconda2-5.1.0-Linux-x86_64.sh
我官網(wǎng)下的最新版。
然后一路回車,出現(xiàn)下面這個時候,輸入yes.
Do you accept the license terms? [yes|no] [no] >>> yes #這輸入yes
然后出現(xiàn)
Do you wish the installer to prepend the Anaconda2 install location to PATH in your /home/wn/.bashrc ? [yes|no] [no] >>> yes #[no]的意思是默認(rèn)no,這輸入yes
Appending source /home/wn/anaconda2/bin/activate to /home/wn/.bashrc
A backup will be made to: /home/wn/.bashrc-anaconda2.bak
需要重新開啟新的服務(wù)器。
如果這里不小心輸入了no,會出現(xiàn)[Anaconda] command not found: conda
解決方案:export PATH=~/anaconda3/bin:$PATH
最后然后出現(xiàn)
Anaconda is partnered with Microsoft! Microsoft VSCode is a streamlined
code editor with support for development operations like debugging, task
running and version control.
To install Visual Studio Code, you will need:
- Administrator Privileges
- Internet connectivity
Visual Studio Code License: https://code.visualstudio.com/license
Do you wish to proceed with the installation of Microsoft VSCode? [yes|no]
#讓你安裝VS,不安,輸入no
然后我們接下來創(chuàng)建虛擬環(huán)境
# 創(chuàng)建一個名為S2P的環(huán)境,指定Python版本是2.7
conda create --name S2P python=2.7
#查看剛才創(chuàng)建的所有環(huán)境
conda list env(指的是哪些包)
conda info --envs(指的是創(chuàng)建環(huán)境的名稱)
# activate激活S2P
source activate S2P
# 激活后,會發(fā)現(xiàn)terminal輸入的地方多了S2P的字樣,實際上,此時系統(tǒng)做的事情就是把默認(rèn)環(huán)境從PATH中去除,再把當(dāng)前2.7加入PATH
python --version
# 可以看到系統(tǒng)已經(jīng)切換到了2.7的環(huán)境
# 如果想返回默認(rèn)的python環(huán)境,運行
source deactivate S2P
# 刪除剛才創(chuàng)建的環(huán)境S2P
conda remove --name S2P --all
接下來在虛擬環(huán)境中安裝tensorflow
anaconda search -t conda tensorflow #查看版本和資源
然后決定你想要下載哪個版本
anaconda show cjj3779/tensorflow-gpu
Using Anaconda API: https://api.anaconda.org
Name: tensorflow-gpu
Summary: TensorFlow helps the tensors flow
Access: public
Package Types: conda
Versions:
+ 1.4.0
To install this package with conda run:
conda install --channel https://conda.anaconda.org/cjj3779 tensorflow-gpu
根據(jù)提示,我們可以執(zhí)行
conda install --channel https://conda.anaconda.org/cjj3779 tensorflow-gpu
當(dāng)然,也可以用conda直接裝固定版本的tensorflow,使用conda裝的好處是,不需要額外裝一些包
conda install --channel https://conda.anaconda.org/anaconda tensorflow=1.6.0
或者conda install tensorflow-gpu=1.4.*
或者
(可以查看這個網(wǎng)站,下載比較受歡迎的tensorflow-gpu版本)[https://anaconda.org/search?q=tensorflow-gpu]
當(dāng)然,還可以選擇清華的鏡像站,但是有時候會不穩(wěn)定,不顯示你想要版本的.whl文件
https://mirrors.tuna.tsinghua.edu.cn/help/tensorflow/
#這里有各種資源,可以直接下在后綴名為.whl的tensorflow版本
那么還有更好的方法,請移步與pypi,搜索tensorflow-gpu,找到你想要的版本
https://pypi.org/
tf.__version__
tf.__path__
執(zhí)行上面兩句話驗證tensorflow,出現(xiàn)版本號就可以了
可能出現(xiàn)的問題!command not found: conda
解決方案:export PATH=~/anaconda3/bin:$PATH