前提
筆者的問題不是網(wǎng)絡(luò)問題
python版本:3.10
本機(jī)CUDA版本:10.2
OS:Windows10
問題
下載torch時報(bào)錯:
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提供的庫中根本沒有對應(yīng)的windows10環(huán)境的torch庫
https://download.pytorch.org/whl/torch
注:cu代表CUDA版本,cp代表python版本
解決
安裝python3.8,注意添加環(huán)境變量
然后以管理員身份打開cmd,執(zhí)行安裝指令文章來源:http://www.zghlxwxcb.cn/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就可以下載
當(dāng)然也可以下載其他版本的torch:
https://pytorch.org/get-started/previous-versions文章來源地址http://www.zghlxwxcb.cn/news/detail-785124.html
到了這里,關(guān)于解決 ERROR: Could not find a version that satisfies the requirement torch==1.10.0+cu102的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!