美文网首页
ubuntu18下pytorch安装gpu版本

ubuntu18下pytorch安装gpu版本

作者: 奋斗_登 | 来源:发表于2020-09-03 00:41 被阅读0次

显卡型号为: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就说明安装成功了.

相关文章

网友评论

      本文标题:ubuntu18下pytorch安装gpu版本

      本文链接:https://www.haomeiwen.com/subject/rxzisktx.html