安装 torchvision 时出错 (python 3.6)

Error installing torchvision (python 3.6)

我正在尝试通过编写来安装 torchvision pip3 install torchvision 但我收到以下消息

Requirement already satisfied: torchvision in ./venv/lib/python3.6/site-packages (0.7.0)
Requirement already satisfied: numpy in ./venv/lib/python3.6/site-packages (from torchvision) (1.19.2)
Requirement already satisfied: pillow>=4.1.1 in ./venv/lib/python3.6/site-packages (from torchvision) (7.2.0)
Collecting torch==1.6.0 (from torchvision)
  Could not find a version that satisfies the requirement torch==1.6.0 (from torchvision) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2, 0.3.0.post4, 0.3.1, 0.4.0, 0.4.1, 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0, 1.1.0.post2, 1.2.0, 1.3.0, 1.3.0.post2, 1.3.1, 1.4.0)
No matching distribution found for torch==1.6.0 (from torchvision)

我目前安装了 torch==1.4.0,但显然不足以安装 torchvision。当我尝试代码 pip3 install torch==1.6.0 我收到以下错误

Collecting torch==1.6.0
  Could not find a version that satisfies the requirement torch==1.6.0 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2, 0.3.0.post4, 0.3.1, 0.4.0, 0.4.1, 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0, 1.1.0.post2, 1.2.0, 1.3.0, 1.3.0.post2, 1.3.1, 1.4.0)
No matching distribution found for torch==1.6.0

有人知道我该如何解决这个问题吗?

转到https://pytorch.org/

并指定您的平台。到目前为止,这是安装所需内容的最佳方式。对于 Windows 可能是这样的:

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

搜索胡萝卜:

我已经解决了这个问题。所以我安装了 torch==1.4.0,因为这是我笔记本电脑上公认的最新版本,但由于某种原因,当我尝试安装 torchvision 时,它立即升级到最新版本 (0.7.0)。我在pytorch网站上发现,torch==1.4.0关联了torchvision==0.5.0。所以我 运行 代码 pip3 install torch==1.4.0 torchvision==0.5.0 卸载 torchvision==0.7.0 并安装 0.5.0。现在它工作正常。希望这个解释有帮助