首页 > 解决方案 > 如何在虚拟环境中的 Windows 上使用 pip 和 python 3.8.3 安装 torch 和 torchvision?

问题描述

我为我的项目创建了一个虚拟环境,我正在尝试torch通过pip.

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

这给了我错误-

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

有的解决方案推荐使用conda,有必要吗?我能不能做到pip

标签: pippytorchtorch

解决方案


您可以尝试直接从 wheel 文件中安装:

pip install https://download.pytorch.org/whl/cu102/torch-1.5.1-cp36-cp36m-win_amd64.whl
pip install https://download.pytorch.org/whl/cu102/torchvision-0.6.1-cp36-cp36m-win_amd64.whl

推荐阅读