系统环境
操作系统:win10
显卡:RTX2060
python: 3.6.5
anaconda: 5.2.0
cuda: 11.0
遇到问题
安装pytorch过程中,遇到http error,失败。
解决方法
- 关键是要修改源,并且是http格式的url,https的链接试了几次都报错。
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
- 安装pytorch的时候,命令后面不要加-c pytorch。 就会默认从清华源下载。
conda install pytorch torchvision cudatoolkit=11.0
参考:
作者:1nvad3r
链接:https://www.jianshu.com/p/94d7c235bf5e
测试结果
>>> import torch
# 查看gpu是否可用
>>> torch.cuda.is_available()
True
# 查看gpu是个数
>>> torch.cuda.device_count()
1
# 查看gpu设备名称
>>> torch.cuda.get_device_name(0)
'GeForce RTX 2060'