遇到的问题
C:\Users\Admin>python -m pip install -e detectron2
Obtaining file:///C:/Users/Admin/detectron2
Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'E:\python--\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Admin\detectron2\setup.py'"'"'; file='"'"'C:\Users\Admin\detectron2\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Admin\AppData\Local\Temp\pip-pip-egg-info-rm9oyyl0'
cwd: C:\Users\Admin\detectron2
Complete output (5 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Admin\detectron2\setup.py", line 10, in
import torch
ModuleNotFoundError: No module named 'torch'
WARNING: Discarding file:///C:/Users/Admin/detectron2. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
整体clone下来的项目安装,进入到下载目录,使用python setup.py build develop,同时相关依赖要满足。具体参考这里:
https://www.aiuai.cn/aifarm1288.html
直接用pip install -detectron2试试,同时安装torch
安装教程参考
https://zhuanlan.zhihu.com/p/88903659