无法在 Windows 上使用 pip 安装 pytorch [英] Can't install pytorch with pip on Windows

查看:39
本文介绍了无法在 Windows 上使用 pip 安装 pytorch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Windows 上安装 Pytorch,我正在使用官方网站的命令https://pytorch.org/get-started/locally/

I'm trying to install Pytorch with Windows and I'm using the commands of the official site https://pytorch.org/get-started/locally/

pip3 install torch==1.2.0 torchvision==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html

这是我选择 Windows、Cuda 10.0 和 Python 3.7 时的命令但是如果我运行它,我会收到错误消息:

This is the command if I choose Windows, Cuda 10.0, and Python 3.7 But if I run this I get the error message:

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

那为什么会这样呢?我的 pip 是 19.2 版本,我在新安装的 python 3.7 环境中

So why does this happen? My pip is version 19.2 and I am in a newly installed python 3.7 environment

推荐答案

您的问题最可能的原因是 Python 的 32 位安装,而 Torch 库依赖于 64 位版本.我遇到了完全相同的问题.

The most likely reason for Your issue is a 32-bit installation of python, while the torch libraries rely on having a 64-bit version. I had exactly the same issue.

只需从命令行启动 python 并观察

Just start python from command line and observe

C:Usersmarci>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32

我的安装现在显示 64 位.如果 Yours 显示 32,则安装 64 位 python.我使用了这个链接:Official python 64-bit Windows安装程序

My installation now shows 64 bits. If Yours shows 32, then install 64-bit python. I used this link: Official python 64-bit Windows installer

这篇关于无法在 Windows 上使用 pip 安装 pytorch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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