Pytorch安装找不到满足要求的版本

2024-10-04 07:28:29 发布

您现在位置:Python中文网/ 问答频道 /正文

当我试图按照他们在网站上建议的方式安装Pytorch时:

pip install torch===1.7.0 torchvision===0.8.1 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

这是出现的错误:

ERROR: Could not find a version that satisfies the requirement torch===1.7.0 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch===1.7.0

我怎样才能解决它


Tags: installpiphttpsorg网站download方式error
2条回答

您很可能错过了结尾处的-f https://download.pytorch.org/whl/torch_stable.html
确保在终端中包含整条线路。即使是链接其余部分缺少的l(来自.html),也会导致您看到错误。一开始可能不容易表现出来的东西

所以确保所有的位子都在那里!i、 e.使用所有铃声和口哨的完整链接,确保没有遗漏任何内容

更新:

查看您的评论,您缺少了https://,使用与您相同的命令,我得到了与您相同的错误,因为它将其视为路径,因此发出错误:

Url 'download.pytorch.org/whl/torch_stable.html' is ignored. It is
either a non-existing path or lacks a specific scheme. 

enter image description here

这进一步证明了我先前提出的观点

首先,我想让所有mac、linux和python 3.8.x用户知道,在命令中添加“https://”并不能解决问题:Proof that it doesn't help or solve anything

原因如下:OP,您的机器上可能安装了python 3.9。不幸的是,pythorch还不支持python3.9。改为安装python 3.8.6,这是当前支持的最新版本。您在尝试安装sklearn或tensorflow等软件包时也会发现类似的问题

答案是:要么等待,要么卸载python并回滚到python 3.8.6 对不起,再好不过了

相关问题 更多 >