Python PyTorch:cpp_扩展名.py:184:UserWarning:检查编译器版本时出错 关于Pytork,我遇到了一个问题:

Python PyTorch:cpp_扩展名.py:184:UserWarning:检查编译器版本时出错 关于Pytork,我遇到了一个问题:,python,windows,pytorch,Python,Windows,Pytorch,当我运行python setup.py build_ext--inplace时 我得到: ... File "C:\python36\lib\distutils\command\build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "C:\python36\lib\distutils\command\build_ext.py",

当我运行python setup.py build_ext--inplace时

我得到:

...

  File "C:\python36\lib\distutils\command\build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
  File "C:\python36\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "C:\python36\lib\site-packages\setuptools\command\build_ext.py", line 199, in build_extension
    _build_ext.build_extension(self, ext)
  File "C:\python36\lib\distutils\command\build_ext.py", line 558, in build_extension
    target_lang=language)
  File "C:\python36\lib\distutils\ccompiler.py", line 717, in link_shared_object
    extra_preargs, extra_postargs, build_temp, target_lang)
  File "C:\python36\lib\distutils\_msvccompiler.py", line 501, in link
    build_temp = os.path.dirname(objects[0])
IndexError: list index out of range
。。。 运行build_ext C:\python36\lib\site packages\torch\utils\cpp\u extension.py:184:UserWarning:检查cl:[WinError 2]Das系统的编译器版本时出错 恩格贝尼·达蒂·尼希特·芬登 warnings.warn({}:{}的编译器版本检查错误。格式(编译器,错误)) 建筑“pointnet2.\u ext”扩展

设置: CUDA 9.0

C:\ProgramFiles(x86)\Microsoft Visual Studio 14.0\VC\bin>nvcc--version nvcc:NVIDIA(R)Cuda编译器驱动程序 版权所有(c)2005-2017英伟达公司 建于2017年9月1日星期五21:08:32中央夏令时 Cuda编译工具,9.0版,V9.0.176

MSVC

C:\ProgramFiles(x86)\Microsoft Visual Studio 14.0\VC\bin>cl 针对x86的Microsoft(R)C/C++优化编译器版本19.00.24215.1 版权所有(C)微软公司。版权所有

Pytorch 1.0.1 (通过PIP安装)

补充: 当我跑步时:

python setup.py安装

我得到:

...

  File "C:\python36\lib\distutils\command\build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
  File "C:\python36\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "C:\python36\lib\site-packages\setuptools\command\build_ext.py", line 199, in build_extension
    _build_ext.build_extension(self, ext)
  File "C:\python36\lib\distutils\command\build_ext.py", line 558, in build_extension
    target_lang=language)
  File "C:\python36\lib\distutils\ccompiler.py", line 717, in link_shared_object
    extra_preargs, extra_postargs, build_temp, target_lang)
  File "C:\python36\lib\distutils\_msvccompiler.py", line 501, in link
    build_temp = os.path.dirname(objects[0])
IndexError: list index out of range
setup.py

setup(
...  
install_requires=requirements,
    ext_modules=[
        CUDAExtension(
            name="pointnet2._ext",
            sources=_ext_sources,
            extra_compile_args={
                "cxx": ["-O2", "-I{}".format("{}/include".format(_ext_src_root))],
                "nvcc": ["-O2", "-I{}".format("{}/include".format(_ext_src_root))],
            },
        )
    ],
...
)

我得到了同样的错误(“Das系统kann die angegebene Datei nicht finden”,仅用英语)。您可以尝试在site packages/torch/utils/cpp_extension.py中找到打印此文件的行(我的是第184行),然后在warnings.warn语句之前插入这些行,这样您就可以看到torch试图查找编译器的确切位置,然后您可以绕过编译器路径使其适合您,但这当然只是一种黑客行为,并不是最好的解决方案:打印(编译器);导入回溯;traceback.print_exc()我得到了同样的错误(“Das System kann die angegebene Datei nicht finden”,仅用英语)。您可以尝试在site packages/torch/utils/cpp_extension.py中找到打印此文件的行(我的是第184行),然后在warnings.warn语句之前插入这些行,这样您就可以看到torch试图查找编译器的确切位置,然后您可以绕过编译器路径使其适合您,但这当然只是一种黑客行为,并不是最好的解决方案:打印(编译器);导入回溯;traceback.print_exc()