官网(https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html)没有给出具体安装步骤,特此记录。
#创建虚环境
conda create -n pyg python=3.8
#安装pytorch
pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
#查看安装版本
python -c "import torch; print(torch.__version__)"
python -c "import torch; print(torch.version.cuda)"
#根据torch和cuda版本下载pyg依赖包
#下载地址 https://data.pyg.org/whl/torch-1.9.0+cu111.html
#注意区分Linux和Windows版本,示例中为Linux版本
#依次安装(注意路径因为文件下载地址)
pip install torch_scatter-2.0.6-cp38-cp38-linux_x86_64.whl
pip install torch_sparse-0.6.9-cp38-cp38-linux_x86_64.whl
pip install torch_cluster-1.5.9-cp38-cp38-linux_x86_64.whl
pip install torch_spline_conv-1.2.1-cp38-cp38-linux_x86_64.whl
pip install torch-geometric