Pytorch最全安装教程
环境管理
创建环境
conda create -n pytorch python=3.7
进入环境
activate pytorch
删除环境
conda remove -n pytorch --all
查看cuda版本
安装
https://pytorch.org/get-started/locally/
https://pytorch.org/get-started/previous-versions/
找到适合自己的cuda的版本
cuda可向下兼容但不能向上兼容
测试
import torch
print(torch.version)
print(torch.version.cuda)
print(torch.backends.cudnn.version())
print(torch.cuda.is_available())
安装的坑 No module named torch_sparse,解决 OSError: [WinError 127] ,Not compiled with CUDA support
原因: torch-cluster torch-geometric torch-scatter torch-sparse安装的版本与pytorch不匹配
安装 torch-cluster torch-geometric torch-scatter torch-sparse
https://pytorch-geometric.com/whl/
找到与torch版本和cuda版本对应的
把对应python版本的torch-cluster torch-geometric torch-scatter torch-sparse下载下来
并用下述形式安装
最后在安装 torch_geometric
pip install torch_geometric -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com