打开Anaconda Prompt
1、新建环境
conda create -n torch python=3.8
2、安装pytorch-gpu
conda activate torch
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda install pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 cudatoolkit=10.2
测试
python
import torch
torch.cuda.is_available()
若返回True
则安装成功,退出python
exit()
3、安装工具包👨🦽
点击这里下载轮子先 共四个轮子要安装
pip install 轮子们的绝对路径
🌰:
pip install C:\...\torch_cluster-1.5.9-cp38-cp38-win_amd64.whl
pip install C:\...\torch_scatter-2.0.9-cp38-cp38-win_amd64.whl
pip install C:\...\torch_sparse-0.6.12-cp38-cp38-win_amd64.whl -i https://pypi.douban.com/simple
pip install C:\...\torch_spline_conv-1.2.1-cp38-cp38-win_amd64.whl
其中torch_sparse
轮子用源是因为它要下载scipy
4、安装Geometric
pip install torch-geometric -i https://pypi.douban.com/simple
5、其他
若 import torch
报错 No module named 'numpy.core._multiarray_umath'
为numpy
版本过低所致,执行
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade numpy