从requirements.txt安装PyTorch

火炬文档说明使用

pip install torch==1.4.0+cpu torchvision==0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

以安装最新版本的PyTorch。当我手动执行此操作但将其添加到req.txt并执行pip install -r req.txt时,它会失败并显示ERROR: No matching distribution

编辑:在req.txt中添加整行,并在此处添加错误。

torch==1.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

torchvision==0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.htmltorch==1.4.0+cpu
ERROR: Could not find a version that satisfies the requirement torch==1.4.0+cpu (from -r requirements.txt (line 1)) (from versions: 0.1.2,0.1.2.post1,0.1.2.post2,0.3.1,0.4.0,0.4.1,1.0.0,1.0.1,1.0.1.post2,1.1.0,1.2.0,1.3.0,1.3.1,1.4.0)
ERROR: No matching distribution found for torch==1.4.0+cpu (from -r requirements.txt (line 1))
dd164572387 回答:从requirements.txt安装PyTorch

在割炬之前的--find-links中添加requirements.txt

--find-links https://download.pytorch.org/whl/torch_stable.html

torch==1.2.0+cpu

来源:https://github.com/pytorch/pytorch/issues/29745#issuecomment-553588171

,
-f https://download.pytorch.org/whl/torch_stable.html 
torch==1.4.0+cpu 
-f https://download.pytorch.org/whl/torch_stable.html
torchvision==0.5.0+cpu

对我来说很好:)

,

您可以执行以下操作:

$ pip install -r req.txt -f https://download.pytorch.org/whl/torch_stable.html

只需将您的PyTorch要求放在req.txt中,如下所示:

torch==1.4.0+cpu

torchvision==0.5.0+cpu

本文链接:https://www.f2er.com/2558342.html

大家都在问