GNN学习第一天

(1) 使用DSW安装cpu 版的pytorch和pyg

在Pytorch 官网;

!pip 的方法安装 !pip install torch 安装torch

在anaconda 里面安装pytorch

https://www.jianshu.com/p/3bed91f4f3ad

1.已经安装好Anaconda

2.搜索cmd>>>打开Anaconda Prompt

3.添加清华镜像:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

conda config --set show_channel_urls yes

4.添加Pytorch镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/

5.安装pytorch:https://pytorch.org 到官网选一个版本

conda install pytorch torchvision torchaudio cpuonly -c pytorch

pip版本 cpu

pip3 install torch torchvision torchaudio

检查安装情况:

import torch 

(2)pyg 安装geometirc 库

pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.8.0+cu111/改成CPU.html

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

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

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

pip install torch-geometric

(3)测试

from torch_geometric.datasets import KarateClub

dataset = KarateClub()

data = dataset[0]  # Get the first graph object.

print(data)



from torch_geometric.datasets import KarateClubdataset = KarateClub()data = dataset[0] # Get the first graph object.print(data)

z作业:

你可能感兴趣的:(GNN学习第一天)