首先,我们要知道:
因此,你如果只需要torch_scatter的话,就安装它就好了,但是如果要torch_geometric的话,就需要全都下载了。
import torch
print(torch.__version__)
print(torch.version.cuda)
注意:
## 先安装这四个
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html
## 最后安装torch-geometric
pip install torch-geometric
其中 {TORCH} 替 换 为 P y T o r c h 的 版 本 号 ,{CUDA} 替换为上面查询得到的CUDA版本号。CUDA 版本号格式 (cpu, cu92, cu101, cu102, cu110, cu111)。例如对于PyTorch 2.0.0 and CUDA 11.7,安装命令如下:
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-2.0.0+cu117.html
pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-2.0.0+cu117.html
pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-2.0.0+cu117.html
pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-2.0.0+cu117.html
pip install torch-geometric
$ python
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from torch_geometric.data import DataLoader
>>>
【1】https://blog.csdn.net/qq_41800917/article/details/120282841