目录

阿里云镜像源加速下载Pytorch whl

目录

直接将 PyTorch 安装指引 中的 https://download.pytorch.org/whl 替换为 https://mirrors.aliyun.com/pytorch-wheels即可。

参考链接:https://developer.aliyun.com/mirror/pytorch-wheels/?spm=a2c6h.25603864.0.0.5ebd6223lk7EDA

原版:

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

阿里云版:

pip3 install torch torchvision torchaudio --index-url https://mirrors.aliyun.com/pytorch-wheels/cu118

因未知原因,按照阿里云的替换方法,仍然无法自动匹配到合适的版本:

pip3 install torch torchvision torchaudio --index-url https://mirrors.aliyun.com/pytorch-wheels/cu118
Looking in indexes: https://mirrors.aliyun.com/pytorch-wheels/cu118
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch

所以我的做法是手动在阿里云镜像网站上找到符合Python、系统、CUDA版本的whl包进行手动安装。

检查Torch是否可用GPU:

import torch
torch.cuda.is_available()