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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM