从 requirements.txt 安装 PyTorch [英] Install PyTorch from requirements.txt

查看:152
本文介绍了从 requirements.txt 安装 PyTorch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Torch 文档说使用

Torch documentation says use

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.

to install the latest version of PyTorch. This works when I do it manually but when I add it to req.txt and do pip install -r req.txt, it fails and says ERROR: No matching distribution.

从 req.txt 添加整行并在此处出错.

adding the whole line from req.txt and error here.

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))

推荐答案

requirements.txt中添加--find-links在torch

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

torch==1.2.0+cpu

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

这篇关于从 requirements.txt 安装 PyTorch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆