代码之家  ›  专栏  ›  技术社区  ›  sixtytrees

detectron2软件包未安装(没有名为“torch”的模块),但我安装了torch

  •  1
  • sixtytrees  · 技术社区  · 5 月前

    当我奔跑时 python.exe -m pip install git+https://github.com/facebookresearch/detectron2.git 来自包含以下内容的文件夹 python.exe 我明白了 ModuleNotFoundError: No module named 'torch' . 然而,火炬进口通常:

    C:\Python310>python.exe
    Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import torch
    >>> torch.__version__
    '2.3.0+cu121'
    

    如何安装 detectron2 ?

    1 回复  |  直到 5 月前
        1
  •  2
  •   dev_light    5 月前

    这个 docs 声明 detectron2 要求:

    Linux或macOS 使用Python 3.7

    PyTorch 1.8和与PyTorch安装相匹配的torchvision。在pytorch.org上一起安装它们以确保这一点。

    OpenCV是可选的,但演示和可视化需要它

    Windows计算机上没有此软件包的明显支持。您可以找到支持Windows的类似软件包或安装 Windows Subsystem for Linux (WSL) 它在您的Windows机器上提供Linux环境。获得WSL后,您可以在该环境中安装此软件包。

    推荐文章