错误处理:安装torch-sparse、torch-spline、torch-scatter、torch-cluster

问题描述

安装torch-sparse的时候,出现了这样的错误

pip install torch-sparse
 ValueError: underlying buffer has been detached
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\16000\appdata\local\programs\python\python37\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\16000\\AppData\\Local\\Temp\\pip-install-d9hgz4t9\\torch-sparse_698c5c1e115f4cf0b4a5f0fa07153d3f\\setup.py'"'"'; __file__='"'"'C:\\Users\\16000\\AppData\\Local\\Temp\\pip-install-d9hgz4t9\\torch-sparse_698c5c1e115f4cf0b4a5f0fa07153d3f\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\16000\AppData\Local\Temp\pip-record-ex4y0frr\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\16000\appdata\local\programs\python\python37\Include\torch-sparse' Check the logs for full command output.

问题是安装的torch-sparse和已经安装好的torch版本不适配

解决方法

1)查看pytorch版本

>>> import torch
>>> print(torch.__version__)
1.7.1+cpu

2)去  https://pytorch-geometric.com/whl/index.html 找相应的版本

错误处理:安装torch-sparse、torch-spline、torch-scatter、torch-cluster_第1张图片

3)点开‘torch-1.7.1+cpu

错误处理:安装torch-sparse、torch-spline、torch-scatter、torch-cluster_第2张图片

4)选择相应的版本,下载之 

下载哪个版本的教程见:报错解决方法1:‘A GDAL API version must be specified.’_UQI-LIUWJ的博客-CSDN博客

5) 安装

错误处理:安装torch-sparse、torch-spline、torch-scatter、torch-cluster_第3张图片 

 

你可能感兴趣的:(其他,pytorch,python,深度学习)