图神经网络环境搭建
1. PyG安装
- 创建一个用于搭建图神经网络的专用虚拟环境,方便后续管理
- 安装Pytorch,PyTorch要安装1.11.*版本的(到历史版本里去找),不要安装1.12.*版本的,不然无法用conda安装PyG
- 进入PyTorch Geometric官网
网址:https://pytorchgeometric.readthedocs.io/en/latest/notes/installation.html
依据版本信息选择命令
- 检查安装结果
import torch
import torch_geometric
- 在jupyter使用本地安装环境
将本地环境加入jupyter,torch_geometric需要在jupyter上用pip重新安装一遍
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.11.0+cu113.html
pip install torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.11.0+cu113.html
问题: 安装obg包时,不知道为什么在jupyter用pip能安装成功,但是在本地环境用conda不行,强制安装后本来安装的pytorch还不行了,只得全部重装一遍