繁体   English   中英

无法在 windows 中通过诗歌安装 torchvision

[英]Cannot install torchvision via poetry in windows

由于这里的答案Poetry 和 PyTorch ,我成功安装了 pytorch

但是,我仍然无法通过诗歌安装 torchvision。

> poetry add torchvision==0.8.2

Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing torchvision (0.8.2)

  RuntimeError

  Unable to find installation candidates for torchvision (0.8.2)

  at ~\.poetry\lib\poetry\installation\chooser.py:72 in choose_for
       68│ 
       69│             links.append(link)
       70│
       71│         if not links:
    →  72│             raise RuntimeError(
       73│                 "Unable to find installation candidates for {}".format(package)
       74│             )
       75│
       76│         # Get the best link


Failed to add packages, reverting the pyproject.toml file to its original content.

我用谷歌搜索并找到了一些答案,上面写着“只需pip install torchvision ”。 但我怀疑它是否有效,因为根据 PyPi( https://pypi.org/project/torchvision/#files ),没有 windows 的 wheel 文件。我试过了,结果如我所料失败了。

有什么方法可以安装与 windows 中最新的 torch(1.7.1) 兼容的最新 torchvisin? + 通过诗歌?

  1. Look in https://download.pytorch.org/whl/torch_stable.html for the version you want to install (torchvision version, python version, CUDA version, OS etc.)
  2. 将 URL 依赖项添加到您的pyproject.toml文件中。 例如,我的依赖项中有 torchvision 1.8.0 使用以下内容
[tool.poetry.dependencies]
python = "^3.8"
torch = {url = "https://download.pytorch.org/whl/cu102/torch-1.8.0-cp38-cp38-win_amd64.whl"}
torchvision = {url = "https://download.pytorch.org/whl/cu102/torchvision-0.9.0-cp38-cp38-win_amd64.whl"}
  1. 从你激活的虚拟环境中poetry update torchvision ,你应该对go很好。

我遇到了同样的问题,我只是重新打开终端并且一切正常。 我想我在一些错误的环境中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM