【已解决】关于Centernet复现,编译最新DCNv2出现的问题 LINK : fatal error LNK1181: 无法打开输入文件

一、前排提示:这可能是最终的解决方法,因为我把csdn几乎所有的方法都试过了。比如:

  1. 添加环境变量
  2. Windows Kits里的rc.exercdll.dll复制到.../VC/...那里
  3. 下载2015、2017、2019vs
  4. 重装系统

二、错误描述:

(MyCode) F:\Graduation_design\Code_4\CenterNet-master\src\lib\models\networks\DCNv2>python setup.py build develop
running build
running build_ext
building '_ext' extension
Emitting ninja build file F:\Graduation_design\Code_4\CenterNet-master\src\lib\models\networks\DCNv2\build\temp.win-amd64-3.6\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
1.10.2
D:\vs2017\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:D:\Anaconda3\envs\MyCode
\lib\site-packages\torch\lib "/LIBPATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\lib/x64" /LIBPATH:D:\Anaconda3\envs\MyCode\libs /LIBPATH:D:\Anaconda3\
envs\MyCode\PCbuild\amd64 /LIBPATH:D:\vs2017\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x64 /LIBPATH:D:\vs2017\VC\Tools\MSVC\14.16.27023\lib\x64 "/LIBPATH:C:\Program Files
(x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kit
s\10\lib\10.0.17763.0\um\x64" c10.lib torch.lib torch_cpu.lib torch_python.lib cudart.lib c10_cuda.lib torch_cuda.lib /EXPORT:PyInit__ext F:\Graduation_design\Code_4\
CenterNet-master\src\lib\models\networks\DCNv2\build\temp.win-amd64-3.6\Release\Graduation_design\Code_4\CenterNet-master\src\lib\models\networks\DCNv2\src\vision.obj
 F:\Graduation_design\Code_4\CenterNet-master\src\lib\models\networks\DCNv2\build\temp.win-amd64-3.6\Release\Graduation_design\Code_4\CenterNet-master\src\lib\models\
networks\DCNv2\src\cpu\dcn_v2_cpu.obj F:\Graduation_design\Code_4\CenterNet-master\src\lib\models\networks\DCNv2\build\temp.win-amd64-3.6\Release\Graduation_design\Co
de_4\CenterNet-master\src\lib\models\networks\DCNv2\src\cpu\dcn_v2_im2col_cpu.obj F:\Graduation_design\Code_4\CenterNet-master\src\lib\models\networks\DCNv2\build\tem
p.win-amd64-3.6\Release\Graduation_design\Code_4\CenterNet-master\src\lib\models\networks\DCNv2\src\cpu\dcn_v2_psroi_pooling_cpu.obj F:\Graduation_design\Code_4\Cente
rNet-master\src\lib\models\networks\DCNv2\build\temp.win-amd64-3.6\Release\Graduation_design\Code_4\CenterNet-master\src\lib\models\networks\DCNv2\src\cuda\dcn_v2_cud
a.obj F:\Graduation_design\Code_4\CenterNet-master\src\lib\models\networks\DCNv2\build\temp.win-amd64-3.6\Release\Graduation_design\Code_4\CenterNet-master\src\lib\mo
dels\networks\DCNv2\src\cuda\dcn_v2_im2col_cuda.obj F:\Graduation_design\Code_4\CenterNet-master\src\lib\models\networks\DCNv2\build\temp.win-amd64-3.6\Release\Gradua
tion_design\Code_4\CenterNet-master\src\lib\models\networks\DCNv2\src\cuda\dcn_v2_psroi_pooling_cuda.obj /OUT:build\lib.win-amd64-3.6\_ext.cp36-win_amd64.pyd /IMPLIB:
F:\Graduation_design\Code_4\CenterNet-master\src\lib\models\networks\DCNv2\build\temp.win-amd64-3.6\Release\Graduation_design\Code_4\CenterNet-master\src\lib\models\n
etworks\DCNv2\src\_ext.cp36-win_amd64.lib

LINK : fatal error LNK1181: 无法打开输入文件“F:\Graduation_design\Code_4\CenterNet\src\lib\models\networks\DCNv2\build\temp.win-amd64-3.6\Release\Graduation_design\Code_4\CenterNet\src\lib\models\networks\DCNv2\src\vision.obj”
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x64\\link.exe' failed with exit status 1181

废话不多说,直接上解决办法。
重新创建conda环境,重装pytorch。舍弃你目前使用的环境,因为你的conda环境已经损坏了,我就纳闷儿了,这conda环境还能损坏。我怀疑可能是我之前重装过几次系统,但是conda环境(MyCode)一直没动,一直在D盘。

三、编译DCNv2命令

python setup.py build develop

最后附上:最新DCNv2下载地址(支持pytorch1.8)

https://codechina.csdn.net/mirrors/jinfagang/DCNv2_latest

你可能感兴趣的:(pytorch,centernet,DCNv2,pytorch,vc)