‘C:\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\bin\\nvcc.exe‘ failed with exit code 2

下载torchlars时的出现的bug详情:error: command ‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin\nvcc.exe’ failed with exit code 2

背景

windows10
Python 3.7
PyTorch 1.8.1
CUDA 11.1
虚拟环境miniconda

目的

为了下载GitHub上的torchlars包

触发bug

将代码包下载到工程文件夹下
输入指令:python setup.py build develop

bug 详细描述

在这里插入图片描述

fatal error C1189: #error: – unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2019 (inclusive) are supported! The nvcc flag ‘-allow-unsupported-compiler’ can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. error: command ‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin\nvcc.exe’ failed with exit code 2

解决方案

下载了 Microsoft Visual Studio 2019 问题解决,由于 Microsoft Visual Studio version不匹配导致该错误

结果

‘C:\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\bin\\nvcc.exe‘ failed with exit code 2_第1张图片
输入python setup.py install
下载torchlars成功
‘C:\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\bin\\nvcc.exe‘ failed with exit code 2_第2张图片

你可能感兴趣的:(bug合集,c++,python,github,visual,studio)