2020:nvcc fatal:在 PATH 中找不到编译器 'cl.exe'

2020: nvcc fatal : Cannot find compiler 'cl.exe' in PATH

我正在尝试 运行 Nvidia 的 StyleGan2。我创建了一个新环境,但未能通过提供的自述文件中规定的检查。

特别是,当我 运行 它时,我得到了您在问题标题中看到的错误。我查了一下,表面上的解决方案是将此路径添加到 env vars

C:\Program Files\Microsoft Visual Studio 10.0\VC\bin

我正在尝试这样做,但我的 VC 文件夹中没有 bin!我只有 includelib,全新安装的 visual studio。

感谢@talonmies,解决方法如下: 首先,默认情况下,全新安装的 VS 不会附带 c++ 包,您需要 select 该包。 其次,现在 cl.exe 的路径似乎在这里

C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.24.28314\bin\Hostx64\x64

在我的例子中,完整的错误信息是:

nvcc fatal : Cannot find compiler 'cl.exe' in PATH

...

No CMAKE_CUDA_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment variable "CUDACXX" or the CMake cache entry CMAKE_CUDA_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

所以我必须这样做:

export CUDACXX="/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe"

成功了。