pytorch cpu版和gpu版国内镜像下载,目前最快下载
·
前言
pytorch的cpu的包可以在国内镜像上下载,但是gpu版的包只能通过国外镜像下载,网上查了很多教程,基本都是手动从先将gpu版whl包下载下来,然后再手动安装,如何最快的通过pip的命令安装呢?下面我细细讲下。
解决办法
注意:阿里云上的pytoch包已经全面更新,可以支持更多的版本了。
目前国内有pytorch的gpu版的whl包只有阿里云上的:https://mirrors.aliyun.com/pytorch-wheels/
这里以11.8为例:
官网中,通过pip命令安装的torch包命令如下:Previous PyTorch Versions | PyTorch
# CUDA 11.8
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu118
然后,网上的各种教程,都是说,直接将https://download.pytorch.org/whl/cu118,改成https://mirrors.aliyun.com/pytorch-wheels/cu118,会直接报如下错误:
哈哈,看到这里,恭喜你被忽悠了。
正确的命令是这样的:
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 -f https://mirrors.aliyun.com/pytorch-wheels/cu118
完美解决!!!
注意注意:
直接使用下面的命令,会默认直接安装最新的gpu版的
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
如果想只安装cpu版的,需要加上 -f https://mirrors.aliyun.com/pytorch-wheels/cpu,如下:
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 -i https://pypi.tuna.tsinghua.edu.cn/simple -f https://mirrors.aliyun.com/pytorch-wheels/cpu
完毕!!!
更多推荐
所有评论(0)