Detectron2 windows系统安装

1.conda create -n detectron2 python=3.8 -y

2.conda activate detectron2

3.在Pytorch官网中找到对应的pytorch版本以及CUDA版本,要求pytorch版本大于1.8

pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

这个是我按照的配置,pytorch=1.8.1 cuda=10.2

4.python -m pip install 'git+https://github.com/facebookresearch/detectron2.git' 

若出现以下错误:error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ 则证明没有安装Microsoft Visual C++。

Microsoft C++ Build Tools - Visual Studio进入这个网址下载安装包

 尽量不要安装在C盘下,会占用至少10G空间

安装完成之后我们需要在Microsoft Visual C++下打开命令行窗口,不然会报如下错误:error: command 'cl.exe' failed: No such file or directory

错误原因是由于没有配置系统变量PATH,导致无法找到cl.exe程序,如果使用自带的Powershell则自动配置该环境变量

在cmd中输入cl.exe,出现以下信息则代表找到该执行程序

 接着我们需要输入以下两行命令,否者会出现如下错误:UserWarning: It seems that the VC environment is activated but DISTUTILS_USE_SDK is not set.This may lead to multiple activations of the VC env.Please set `DISTUTILS_USE_SDK=1` and try again.

SET DISTUTILS_USE_SDK=1
call "F:\Microsoft_visual_studio\BuildTools\VC\Auxiliary\Build\vcvars64.bat"

注意第二行代码vcvars64.bat位置是由安装Microsoft visual C++位置所决定的,不要照搬

5.最后输入:python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'

则自动安装detectron2依赖包

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值