detectron2 框架安装

安装detectron2
detectron2安装有两种办法,一种直接通过pip下载

python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
但对高版本的cuda大概率会报错,另一种办法是先git clone到本地再编译,指令如下

git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2
编译过程中可能遇到报错

UserWarning: There are no g++ version bounds defined for CUDA version 12.2
这是因为detectron2没有找到g++文件导致编译出错,解决办法是在.bashrc文件中添加g++文件的正确路径,或者在命令行中直接export,后一种方法每次编译前都要重新执行,前一种方法只用需要找到对应位置更改,如果没有的话直接添加即可,具体做法如下:

image

--no-build-isolation

加上这个直接成功, 不用配置环境变量,像网上一样

posted @ 2025-11-25 18:50  E_sheep  阅读(86)  评论(0)    收藏  举报