前提
笔者的问题不是网络问题
python版本:3.10
本机CUDA版本:10.2
OS:Windows10
问题
下载torch时报错:
pip install torch==1.10.0+cu102 torchvision==0.11.0+cu102 torchaudio==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html
Looking in indexes: https://mirrors.cloud.tencent.com/pypi/simple
Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch==1.10.0+cu102 (from versions: 1.11.0, 1.11.0+cpu, 1.11.0+cu113, 1.11.0+cu115, 1.12.0, 1.12.0+cpu, 1.12.0+cu113, 1.12.0+cu116, 1.12.1, 1.12.1+cpu, 1.12.1+cu113, 1.12.1+cu116, 1.13.0, 1.13.0+cpu, 1.13.0+cu116, 1.13.0+cu117, 1.13.1, 1.13.1+cpu, 1.13.1+cu116, 1.13.1+cu117, 2.0.0, 2.0.0+cpu, 2.0.0+cu117, 2.0.0+cu118)
ERROR: No matching distribution found for torch==1.10.0+cu102
原因
python3.10目前在pytorch提供的库中根本没有对应的windows10环境的torch库
https://download.pytorch.org/whl/torch
注:cu代表CUDA版本,cp代表python版本
解决
安装python3.8,注意添加环境变量
然后以管理员身份打开cmd,执行安装指令文章来源:https://www.toymoban.com/news/detail-785124.html
C:\Windows\system32>pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu102
Looking in indexes: https://download.pytorch.org/whl/cu102
Collecting torch
Using cached https://download.pytorch.org/whl/cu102/torch-1.10.2%2Bcu102-cp38-cp38-win_amd64.whl (1486.0 MB)
Collecting torchvision
Using cached https://download.pytorch.org/whl/cu102/torchvision-0.11.3%2Bcu102-cp38-cp38-win_amd64.whl (2.6 MB)
Collecting torchaudio
Using cached https://download.pytorch.org/whl/cu102/torchaudio-0.10.2%2Bcu102-cp38-cp38-win_amd64.whl (336 kB)
Collecting typing-extensions
Using cached https://download.pytorch.org/whl/typing_extensions-4.4.0-py3-none-any.whl (26 kB)
Collecting pillow!=8.3.0,>=5.3.0
Using cached https://download.pytorch.org/whl/Pillow-9.3.0-cp38-cp38-win_amd64.whl (2.5 MB)
Collecting numpy
Using cached https://download.pytorch.org/whl/numpy-1.24.1-cp38-cp38-win_amd64.whl (14.9 MB)
Installing collected packages: typing-extensions, torch, pillow, numpy, torchvision, torchaudio
Successfully installed numpy-1.24.1 pillow-9.3.0 torch-1.10.2+cu102 torchaudio-0.10.2+cu102 torchvision-0.11.3+cu102 typing-extensions-4.4.0
C:\Windows\system32>python
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
True
>>> torch.__version__
'1.10.2+cu102'
指令来源:https://pytorch.org/get-started/locally/
我这里直接将后缀改为自己的CUDA版本cu102就可以下载
当然也可以下载其他版本的torch:
https://pytorch.org/get-started/previous-versions
文章来源地址https://www.toymoban.com/news/detail-785124.html
到了这里,关于解决 ERROR: Could not find a version that satisfies the requirement torch==1.10.0+cu102的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!