最近要使用YOLO v11训练模型,下载gpu版本的pytorch时候简直让人抓狂,官网的速度慢的像龟速,几KB每秒,国内镜像嘛一堆大聪明给的都用不了,最后终于看到一篇文章写的可用,这里记录一下:
首先镜像源是阿里的:
https://mirrors.aliyun.com/pytorch-wheels/

从cu75~cu132都有,下载速度都在MB/S级别
cu126地址:pytorch-wheels-cu126安装包下载-开源镜像站-阿里云
下载命令如下(以cu126为例,不指定版本):
bash
pip install torch torchvision torchaudio -f https://mirrors.aliyun.com/pytorch-wheels/cu126
指定版本如下:
bash
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 -f https://mirrors.aliyun.com/pytorch-wheels/cu126
需要注意的是,这里pip命令指定url用到的参数是
-f,而不是常用的-i或--index-url用
pip install -h看看这两个参数的区别:可以看到
-f更偏向于从指定目录中查找指定包,并进行安装。
