Pytorch的安装
检查是否有合适的GPU,若有安装Cuda与CuDNN
NVIDA控制面板,帮助,系统信息,驱动程序版本 451.67(本机)
下载pytorch安装文件,进行pytorch的安装
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
#安装失败,为conda添加镜像
conda config --show-sources #查看源
?
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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda info
conda config --remove channels 镜像源
可以去掉-c pytorch 参数“该参数表示指定下载通道”
检测安装结果
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
1.9.0
>>> print(torch.version.cuda)
10.2
>>> print(torch.backends.cudnn.version())
7605
>>> print(torch.cuda.gat_device_name(0))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'torch.cuda' has no attribute 'gat_device_name'
>>> print(torch.cuda.get_device_name(0))
GeForce 940MX
>>> print(torch.cuda.is_availabel())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'torch.cuda' has no attribute 'is_availabel'
搭建DGL环境
#搭建DGL环境
conda install -c dglteam dgl #安装CPU版本
conda install -c dglteam dgl-cuda10.2 #安装CUDA10.2版本
?
?
#卸载
conda uninstall -c dglteam dgl-cuda10.0
?
?
#安装环境后测试
import dgl
print(dgl.__version__)
?
|