anaconda配置深度学习虚拟环境(pytorch)

具体参照以下该篇博文
链接: link.
本文主要是用于学习记录

前提

1、安装了pycharm
2、安装了anaconda
3、本机含有GPU

具体指令流程

1创建虚拟环境

conda create -n name(环境名称) python=3.6(指定python版本)

2激活环境

source activate name

3安装cuda与cudnn:
(1)添加清华源:

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

(2)安装cuda:

conda install cudatoolkit=8.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/

(3)安装cudnn

conda install cudnn=7.0.5 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/

每个不同镜像网站里面包含各种不同的下载包
根据自己的需求下载对应包
注意cuda与cudnn版本应该相互对应
关于cuda与cuDNN具体查询
cuda:https://developer.nvidia.com/cuda-toolkit-archive
cuDNN:https://developer.nvidia.com/rdp/cudnn-archive

(4)安装pytorch
在官网选择适合自己的pytorch程序包
链接https://pytorch.org/get-started/locally/

Logo

更多推荐