显卡型号为:GeForce GTX 1660
1.安装conda
参考:https://zhuanlan.zhihu.com/p/89356758
2.创建pytorch环境
#设置清华源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
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/pkgs/free/
conda config --set show_channel_urls yes
#显示配置
conda config --show
conda create -n pytorch python=3.6
3.安装pytorch
前提是已经安装显卡驱动,显示如下
nvidia-smi
#查看版本,注意这里的版本要和pytorh选择的版本一致
nvcc -V
官网获取安装命令 https://pytorch.org/get-started/locally/#linux-prerequisites
#去掉-c pytorch,这样使用国内源下载快
conda install pytorch torchvision cudatoolkit=10.0
等着安装完毕即可
4.验证安装
(pytch) root@liubuntu:~# python
Python 3.6.10 |Anaconda, Inc.| (default, May 8 2020, 02:54:21)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
True
>>>
执行torch.cuda.is_available()后显示True就说明安装成功了.
网友评论