PyTorch的安装教程_酒归.的博客-CSDN博客_怎么安装pytorch
按照这个,中间出现过问题,
尝试过:
conda create -n pytorch_1.11_cpu python==3.9
C:\Users\Administrator\.condarc
conda activate pytorch_1.11_cpu
(pytorch_1.11_cpu) C:\Users\Administrator>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
Warning: 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/' already in 'channels' list, moving to the top
(pytorch_1.11_cpu) C:\Users\Administrator>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
(pytorch_1.11_cpu) C:\Users\Administrator>conda config --set show_channel_urls yes
(pytorch_1.11_cpu) C:\Users\Administrator>conda install pytorch torchvision torchaudio cpuonly -c pytorch
channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
show_channel_urls: true
pytorch和torchvision下载失败,主要是anaconda延迟过高导致
增加国内镜像源来安装
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
最后保险起见,多加了几个源
conda install pytorch torchvision torchaudio cpuonly -c pytorch中把 -c pytorch去掉,直接从清华镜像中下载变成conda install pytorch torchvision torchaudio cpuonly
就可以了
(pytorch_1.11_cpu) C:\Users\Administrator>python
Python 3.6.15 (default, Dec 3 2021, 18:25:24) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available
<function is_available at 0x000001BB06602488>
>>> torch.cuda.is_available()
False
False说明只能用CPU,安装的就是CPU版本