annaconda安装pytorch方法

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 --set show_channel_urls yes

2、可以添加额外的库–第三方源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

3、创建虚拟环境

conda create -n $YOUR_NAME$ python=3.6

4、安装pytorch

pip install torch==1.1.0 torchvision==0.3.0 (pip安装,cuda、cudnn需要事先安装好)
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0 (自动安装cuda、cudnn)
这里一定要注意,去掉-c pytorch,安装的时候才会默认从清华源下载相应的包
conda install pytorch torchvision cudatoolkit=9.0

5、如何查看pytorch对应的cuda版本?

打开终端输入:python

输入命令:import torch

再输入:print(torch.version.cuda)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值