gpt4 book ai didi

python - 如何使用 pip 在 Python 3.7/Windows 10 上安装 PyTorch

转载 作者:行者123 更新时间:2023-12-01 06:47:30 26 4
gpt4 key购买 nike

我正在尝试使用 pip 安装PyTorch 1.3:

pip3 install torch==1.3.1+cpu torchvision==0.4.2+cpu -f https://download.pytorch.org/whl/torch_stable.html

我从这个页面得到了命令行: https://pytorch.org/get-started/locally/#start-locally

失败,并显示以下错误消息:

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

使用详细模式 (-v) 提供更多信息:

Skipping link: unsupported archive format: .html: 
https://download.pytorch.org/whl/torch_stable.html (from -f)
Analyzing links from page https://pypi.org/simple/torch/

pip 似乎无法使用我提供的 url,而是会从另一个 URL 获取包。那个最多支持Python 3.6。由于我已经安装了 3.7.5(最初提供的 URL 支持),所以没有任何软件包匹配,因此失败。

我可以降级到 3.6,但由于 3.7 已得到官方支持,我想首先尝试解决该问题。

<小时/>

编辑:pip 是最新的。我在 Windows 10 和 7 64 位计算机上遇到完全相同的错误。另:PyTorch页面说:

Please ensure that you have met the prerequisites below (e.g., numpy)

但据我所知,该部分没有列出任何库。在我的测试期间,numpy 已安装并且是最新的。

根据要求,以下是 pip 的完整输出: https://pastebin.com/8Wpqp6du

最佳答案

您的错误被触发,因为版本 1.3.1+cpu 不存在。

如果您访问 pytorch.org,您将能够选择 pytorch 的版本和您的操作系统,其中它将为您提供正确安装 pyTorch 的命令,对于 Python 3.7 和 PIP,请使用以下命令:

pip3 install --find-links https://download.pytorch.org/whl/torch_stable.html torch==1.3.1 torchvision==0.4.2

请记住检查您使用的 pip3 二进制文件是否是通过 Python 3.7 安装的。

此外,请注意您指向的文档适用于 MacOS。

关于python - 如何使用 pip 在 Python 3.7/Windows 10 上安装 PyTorch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59161453/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com