【问题标题】:How to install Torch in Python 2.7如何在 Python 2.7 中安装 Torch
【发布时间】:2020-07-11 15:02:01
【问题描述】:

我应该在 Python 2.7 中运行我的代码。我想在 Python 2.7 中安装 Torch,但是当我运行这段代码时,它给了我错误:

代码:

pip install torch==1.3.1+cpu torchvision==0.4.2+cpu -f https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch==1.3.1+cpu

还有这段代码:

pip install torch==1.4.0+cpu torchvision==0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
Error:  Could not find a version that satisfies the requirement torch==1.4.0+cpu

有人可以帮助我吗? 太感谢了。

【问题讨论】:

  • 什么操作系统?您应该知道 Python 2 已停产,因此使用它时 htings 可能会中断,也可能不会中断。
  • 请提供您的操作系统信息。也尝试将-f https://download.pytorch.org/whl/torch_stable.html 传递给pip
  • 感谢您的回复。这是我的操作系统:Windows-10-10.0.18362 以及你写的 pass -f ...,其实我不明白你在说什么。

标签: python python-2.7 pip torch torchvision


【解决方案1】:

在不精确版本的情况下尝试:

python -m pip install torch torchvision --user

但如果您绝对需要问题中列出的版本,您可以尝试install from source

【讨论】:

    猜你喜欢
    • 2019-10-04
    • 2018-11-25
    • 2016-05-22
    • 2011-10-19
    • 2011-10-08
    • 2020-02-03
    • 2017-09-02
    • 2017-11-21
    • 1970-01-01
    相关资源
    最近更新 更多