torch_scatter安装踩坑实录

由于运行代码出现如下报错

ModuleNotFoundError: No module named 'torch_scatter'

因此,在网上找到一篇博客【不好使】

pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.12.1+cu116.html
(match) F:\matchCode\SuperGlue_training-main>pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.12.1+cu116.html
Looking in links: https://pytorch-geometric.com/whl/torch-1.12.1+cu116.html
Collecting torch-scatter
  Using cached torch_scatter-2.1.1.tar.gz (107 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: torch-scatter
  Building wheel for torch-scatter (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [111 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-37
      creating build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\placeholder.py -> build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\scatter.py -> build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\segment_coo.py -> build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\segment_csr.py -> build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\testing.py -> build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\utils.py -> build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\__init__.py -> build\lib.win-amd64-cpython-37\torch_scatter
      creating build\lib.win-amd64-cpython-37\torch_scatter\composite
      copying torch_scatter\composite\logsumexp.py -> build\lib.win-amd64-cpython-37\torch_scatter\composite
      copying torch_scatter\composite\softmax.py -> build\lib.win-amd64-cpython-37\torch_scatter\composite
      copying torch_scatter\composite\std.py -> build\lib.win-amd64-cpython-37\torch_scatter\composite
      copying torch_scatter\composite\__init__.py -> build\lib.win-amd64-cpython-37\torch_scatter\composite
      running egg_info
      writing torch_scatter.egg-info\PKG-INFO
      writing dependency_links to torch_scatter.egg-info\dependency_links.txt
      writing requirements to torch_scatter.egg-info\requires.txt
      writing top-level names to torch_scatter.egg-info\top_level.txt
      reading manifest file 'torch_scatter.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files matching '*' found under directory 'test'
      adding license file 'LICENSE'
      writing manifest file 'torch_scatter.egg-info\SOURCES.txt'
      running build_ext
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\utils\cpp_extension.py:346: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
        warnings.warn(f'Error checking compiler version for {compiler}: {error}')
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\utils\cpp_extension.py:813: UserWarning: The detected CUDA version (11.7) has a minor version mismatch with the version that was used to compile PyTorch (11.6). Most likely this shouldn't be a problem.
        warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
      building 'torch_scatter._scatter_cpu' extension
      creating build\temp.win-amd64-cpython-37
      creating build\temp.win-amd64-cpython-37\Release
      creating build\temp.win-amd64-cpython-37\Release\csrc
      creating build\temp.win-amd64-cpython-37\Release\csrc\cpu
      "D:\Visual Studio Community 2015\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DWITH_PYTHON -Dtorchscatter_EXPORTS -Icsrc -ID:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include -ID:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\torch\csrc\api\include -ID:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\TH -ID:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\THC -ID:\anaconda\AnacondaInstall\envs\match\include -ID:\anaconda\AnacondaInstall\envs\match\Include "-ID:\Visual Studio Community 2015\VC\INCLUDE" "-ID:\Visual Studio Community 2015\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /EHsc /Tpcsrc\cpu\scatter_cpu.cpp /Fobuild\temp.win-amd64-cpython-37\Release\csrc\cpu\scatter_cpu.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -O3 -DAT_PARALLEL_OPENMP /openmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_scatter_cpu -D_GLIBCXX_USE_CXX11_ABI=0
      cl: 命令行 warning D9002 :忽略未知选项“-O3”
      scatter_cpu.cpp
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/macros/Macros.h(143) : warning C4067: 预处理器指令后有意外标记 - 应输入换行符
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(44) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(44) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(44) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(45) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(45) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(45) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(46) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(46) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(46) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(47) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(47) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(47) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(48) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(48) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(48) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(49) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(49) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(49) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(50) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(50) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(50) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(51) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(51) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(51) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(52) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(52) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(52) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(53) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(53) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(53) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(54) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(54) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(54) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(55) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(55) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(55) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(56) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(56) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(56) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(57) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(57) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(57) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(58) : error C2146: 语法错误: 缺少“;”(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(58) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(58) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(61) : error C2144: 语法错误:“int”的前面应有“;”
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(61) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(61) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(73) : error C2057: 应输入常量表达式
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/util/C++17.h(27) : fatal error C1189: #error :  You need C++14 to compile PyTorch
      error: command 'D:\\Visual Studio Community 2015\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for torch-scatter
  Running setup.py clean for torch-scatter
Failed to build torch-scatter
Installing collected packages: torch-scatter
  Running setup.py install for torch-scatter ... error
  error: subprocess-exited-with-error

  × Running setup.py install for torch-scatter did not run successfully.
  │ exit code: 1
  ╰─> [113 lines of output]
      running install
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\setuptools\command\install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        setuptools.SetuptoolsDeprecationWarning,
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-37
      creating build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\placeholder.py -> build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\scatter.py -> build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\segment_coo.py -> build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\segment_csr.py -> build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\testing.py -> build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\utils.py -> build\lib.win-amd64-cpython-37\torch_scatter
      copying torch_scatter\__init__.py -> build\lib.win-amd64-cpython-37\torch_scatter
      creating build\lib.win-amd64-cpython-37\torch_scatter\composite
      copying torch_scatter\composite\logsumexp.py -> build\lib.win-amd64-cpython-37\torch_scatter\composite
      copying torch_scatter\composite\softmax.py -> build\lib.win-amd64-cpython-37\torch_scatter\composite
      copying torch_scatter\composite\std.py -> build\lib.win-amd64-cpython-37\torch_scatter\composite
      copying torch_scatter\composite\__init__.py -> build\lib.win-amd64-cpython-37\torch_scatter\composite
      running egg_info
      writing torch_scatter.egg-info\PKG-INFO
      writing dependency_links to torch_scatter.egg-info\dependency_links.txt
      writing requirements to torch_scatter.egg-info\requires.txt
      writing top-level names to torch_scatter.egg-info\top_level.txt
      reading manifest file 'torch_scatter.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files matching '*' found under directory 'test'
      adding license file 'LICENSE'
      writing manifest file 'torch_scatter.egg-info\SOURCES.txt'
      running build_ext
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\utils\cpp_extension.py:346: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
        warnings.warn(f'Error checking compiler version for {
    
    compiler}: {
    
    error}')
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\utils\cpp_extension.py:813: UserWarning: The detected CUDA version (11.7) has a minor version mismatch with the version that was used to compile PyTorch (11.6). Most likely this shouldn't be a problem.
        warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
      building 'torch_scatter._scatter_cpu' extension
      creating build\temp.win-amd64-cpython-37
      creating build\temp.win-amd64-cpython-37\Release
      creating build\temp.win-amd64-cpython-37\Release\csrc
      creating build\temp.win-amd64-cpython-37\Release\csrc\cpu
      "D:\Visual Studio Community 2015\VC\BIN\x86_amd64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DWITH_PYTHON -Dtorchscatter_EXPORTS -Icsrc -ID:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include -ID:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\torch\csrc\api\include -ID:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\TH -ID:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\THC -ID:\anaconda\AnacondaInstall\envs\match\include -ID:\anaconda\AnacondaInstall\envs\match\Include "-ID:\Visual Studio Community 2015\VC\INCLUDE" "-ID:\Visual Studio Community 2015\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /EHsc /Tpcsrc\cpu\scatter_cpu.cpp /Fobuild\temp.win-amd64-cpython-37\Release\csrc\cpu\scatter_cpu.obj /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -O3 -DAT_PARALLEL_OPENMP /openmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_scatter_cpu -D_GLIBCXX_USE_CXX11_ABI=0
      cl: 命令行 warning D9002 :忽略未知选项“-O3”
      scatter_cpu.cpp
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/macros/Macros.h(143) : warning C4067: 预处理器指令后有意外标记 - 应输入换行符
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(44) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(44) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(44) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(45) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(45) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(45) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(46) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(46) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(46) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(47) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(47) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(47) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(48) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(48) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(48) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(49) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(49) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(49) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(50) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(50) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(50) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(51) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(51) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(51) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(52) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(52) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(52) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(53) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(53) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(53) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(54) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(54) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(54) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(55) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(55) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(55) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(56) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(56) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(56) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(57) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(57) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(57) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(58) : error C2146: 语法错误: 缺少“;(在标识符“DeviceType”的前面)
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(58) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(58) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(61) : error C2144: 语法错误:“int”的前面应有“;”
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(61) : error C4430: 缺少类型说明符 - 假定为 int。注意:  C++ 不支持默认 int
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(61) : error C2086: “int c10::constexpr”: 重定义
              D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(43) : 参见“c10::constexpr”的声明
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/core/DeviceType.h(73) : error C2057: 应输入常量表达式
      D:\anaconda\AnacondaInstall\envs\match\lib\site-packages\torch\include\c10/util/C++17.h(27) : fatal error C1189: #error :  You need C++14 to compile PyTorch
      error: command 'D:\\Visual Studio Community 2015\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> torch-scatter

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

正确命令

$ pip install  --no-index torch-scatter -f https://pytorch-geometric.com/whl/torch-1.12.1+cu116.html

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_42888638/article/details/131499461