PyG(pytorch-geometric)安装

1、新建环境:

conda create -n pytorch(PyG) python=3.6

2、激活环境

activate pytorch(PyG)

3、安装pytorch(GPU)版本。

4、检查pytorch版本与CUDA版本:

>>python -c "import torch; print(torch.__version__)"  

>>1.10.1

>>python -c "import torch; print(torch.version.cuda)"

>>10.2

5、安装pytorch-geometric:

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
pip install torch-geometric

其中torch换成自己的torch版本,CUDA换成自己的CUDA版本。

例如,我的实例:

pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.10.1+cu102.html

pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.10.1+cu102.html

pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-1.10.1+cu102.html

pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-1.10.1+cu102.html

pip install torch-geometric 

6、测试:

     import torch_geometric.transforms as T

  from torch_geometric.nn import GCNConv,ChebConv

posted @ 2021-12-24 16:22  淼淼兮予怀  阅读(2234)  评论(0编辑  收藏  举报