cd到安裝包所在目錄,安裝:bash Anaconda3-5.1.0-Linux-x86_64.sh
創建虛擬環境:conda create -n your_env_name python=3.6
激活虛擬環境:source activate your_env_name
添加conda國內鏡像:
-
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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
-
conda config --set show_channel_urls yes
安裝cuda:conda install cudatoolkit=9.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/
安裝cudnn:conda install cudnn=7.4.1 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/
安裝pytorch指定版本:conda install pytorch=0.3.0 torchvision=0.2.0 -c soumith
或
根據電腦環境,按照pytorch官網對應代碼安裝
torch官網:https://pytorch.org/get-started/locally/
注:
安裝conda完成后,輸入conda list,若出現未找到命令,則需修改環境變量:export PATH=~/anaconda3/bin:$PATH(此法每次開機后都要修改,也可修改配置文件永久生效)
每個不同鏡像網站里面包含各種不同的下載包,可根據自己的需求打開查找對應的安裝包,
如cudatoolkit 8.0.3 在https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/內,
則安裝命令如:conda install cudatoolkit=8.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/ 即可。