官方给的命令
conda install pytorch torchvision cuda100 -c pytorch
1⃣️源码安装
https://blog.csdn.net/weixin_40919942/article/details/80422718
2⃣️换源
conda config --prepend channels http://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --prepend channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --prepend channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --prepend channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
vi ~/.condarc查看修改
出现问题:
CondaError: CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/pytorch/linux-64/cuda100-1.0-0.tar.bz2>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
安装命令改成
conda install pytorch torchvision cuda100(删去通道 -c pytorch)
即可
测试:
但是装完发现版本不匹配。。。
于是
参考了https://blog.csdn.net/Miya_coding/article/details/82666790
https://blog.csdn.net/sinat_33425327/article/details/84823272
http://www.pianshen.com/article/560640807/
pytorch0.4.1+CUDA8.0+win10+Anaconda安装
安装教程:
1,首先添加镜像:conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
2,下载离线包:https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/
在里面选择:pytorch-0.4.1-py36_cuda80_cudnn7he774522_1.tar.bz2(其他的类似)
3,选择下载路径:cd 路径
4,在下载包的路径中打开命令行:conda install --offline (包的名字)
conda install --offline pytorch-0.4.1-py36_cuda80_cudnn7he774522_1.tar.bz2
5,安装torchvision
pip install torchvision
测试CUDA是否安装好
# CUDA TEST
import torch
x = torch.Tensor([1.0])
xx = x.cuda()
print(xx)
# CUDNN TEST
from torch.backends import cudnn
print(cudnn.is_acceptable(xx))
---------------------