【Python pytorch问题】安装torch_scatter出现的问题:ModuleNotFoundError: No module named ‘torch_scatter‘

问题ModuleNotFoundError: No module named ‘torch_scatter’

  1. 安装torch_scatter出现没有这个模块,所以就安装了一下这个模块
pip install torch_scatter

结果一路飘红,出现以下错误:

running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\torch_scatter
  copying torch_scatter\placeholder.py -> build\lib.win-amd64-3.7\torch_scatter
  copying torch_scatter\scatter.py -> build\lib.win-amd64-3.7\torch_scatter
  copying torch_scatter\segment_coo.py -> build\lib.win-amd64-3.7\torch_scatter
  copying torch_scatter\segment_csr.py -> build\lib.win-amd64-3.7\torch_scatter
  copying torch_scatter\utils.py -> build\lib.win-amd64-3.7\torch_scatter
  copying torch_scatter\__init__.py -> build\lib.win-amd64-3.7\torch_scatter
  creating build\lib.win-amd64-3.7\torch_scatter\composite
  copying torch_scatter\composite\logsumexp.py -> build\lib.win-amd64-3.7\torch_scatter\composite
  copying torch_scatter\composite\softmax.py -> build\lib.win-amd64-3.7\torch_scatter\composite
  copying torch_scatter\composite\std.py -> build\lib.win-amd64-3.7\torch_scatter\composite
  copying torch_scatter\composite\__init__.py -> build\lib.win-amd64-3.7\torch_scatter\composite
  running build_ext
  D:\Anaconda3\envs\recbole\lib\site-packages\torch\utils\cpp_extension.py:322: UserWarning: Error checking compiler version for cl: [WinError 2] 绯荤粺鎵句笉鍒版寚瀹氱殑鏂囦欢
銆\x82
    warnings.warn(f'Error checking compiler version for {compiler}: {error}')
  D:\Anaconda3\envs\recbole\lib\site-packages\torch\utils\cpp_extension.py:788: UserWarning: The detected CUDA version (11.5) has a minor version mismatch with the version that was used to compile PyTorch (11.3). 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
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for torch-scatter

看了一篇这篇博文(有兴趣的可以点击),说是最后一句,缺少c++编译,应该下载一个,所以就在vscode里面安装了c++的插件,但是还是未解决
2. 出现以下错误,说当前这个channel有问题,要去anconda官网寻找一个可以用的,结果按照这个博文去寻找,照着语句安装也未解决【Python pytorch问题】安装torch_scatter出现的问题:ModuleNotFoundError: No module named ‘torch_scatter‘_第1张图片
3. 最后在Gitbub中下载安装torch_scatter,命令为
https://github.com/rusty1s/pytorch_scatter

conda install pytorch-scatter -c pyg

解决了问题,成功安装torch_scatter
【Python pytorch问题】安装torch_scatter出现的问题:ModuleNotFoundError: No module named ‘torch_scatter‘_第2张图片

你可能感兴趣的:(PythonBug解决,自我学习,记录,pytorch,python,深度学习)