前提:此电脑中已经安装好了Anaconda环境
(一)查看创建的虚拟环境中torch的版本
import torch
torch.__version__
(二)针对安装的 torch 版本,去官网下载torch-geometric 依赖的对应版本 torch-sparse、torch-cluster、torch-spline-conv 和torch-scatter库的whl文件。然后,pip安装。
pip install 你的下载地址/torch_sparse.......whl
或者
直接使用命令下载对应版本安装
pip --no-cache-dir install torch-scatter -f https://data.pyg.org/whl/torch-1.12.1+${cpu}.html
pip --no-cache-dir install torch-sparse -f https://data.pyg.org/whl/torch-1.12.1+${cpu}.html
pip --no-cache-dir install torch-cluster -f https://data.pyg.org/whl/torch-1.12.1+${cpu}.html
pip --no-cache-dir install torch-spline-conv -f https://data.pyg.org/whl/torch-1.12.1+${cpu}.html
(三)安装torch-geometric
pip install torch_geometric
都需要较长的安装时间。
...
Successfully built torch-scatter
Installing collected packages: torch-scatter
Successfully installed torch-scatter-2.1.2
...
Successfully built torch-sparse
Installing collected packages: torch-sparse
Successfully installed torch-sparse-0.6.18
...
Successfully built torch-cluster
Installing collected packages: torch-cluster
Successfully installed torch-cluster-1.6.3
...
Successfully built torch-spline-conv
Installing collected packages: torch-spline-conv
Successfully installed torch-spline-conv-1.2.2
...
Installing collected packages: psutil, MarkupSafe, jinja2, torch-geometric
Successfully installed MarkupSafe-2.1.5 jinja2-3.1.4 psutil-6.0.0 torch-geometric-2.5.3