Linux服务器下配置pytorch+cuda
- 查看版本
使用 **nvcc -V** 命令查看版本信息
![Linux服务器下用conda配置pytorch+cuda](https://img.it610.com/image/info8/495ce3bbf6864798b2fc4391e80572e7.jpg)
文章图片
- 创建虚拟环境
Anaconda创建环境:
比如,创建pyhon=3.6的版本环境取名叫 pytorch_gpu
conda create -npytorch_gpu python=3.6
![Linux服务器下用conda配置pytorch+cuda](https://img.it610.com/image/info8/2997652d63d84e72953d259a3bfd45fa.jpg)
文章图片
![Linux服务器下用conda配置pytorch+cuda](https://img.it610.com/image/info8/1791265eed80442196356d61af4b6550.jpg)
文章图片
下载完毕后;
激活虚拟环境
source activate pytorch_gpu(pytorch_gpu是你自己命名的虚拟环境名字)
- 为服务器配置镜像
如果你已经配置了清华的镜像,不用理睬,或者可以接受下载速度慢的问题,也可以跳过这一步。
进入官网你会看到如下界面:
![Linux服务器下用conda配置pytorch+cuda](https://img.it610.com/image/info8/3084e64b2f3c486aa90f484d77ebf653.jpg)
文章图片
将命令复制。
wget https://tuna.moe/oh-my-tuna/oh-my-tuna.py
sudo python oh-my-tuna.py --global
![Linux服务器下用conda配置pytorch+cuda](https://img.it610.com/image/info8/9ae8bbc6b9a94a3c9a39c45967526c6a.jpg)
文章图片
- 进入pytorch官网
网址:https://pytorch.org/
文章图片
然后找到你的服务器支持的版本(千万别选错了),复制对应的命令:
conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0 -c pytorch
![Linux服务器下用conda配置pytorch+cuda](https://img.it610.com/image/info8/5a3dd5c8f85f4f608838cab24116c512.jpg)
文章图片
【Linux服务器下用conda配置pytorch+cuda】
![Linux服务器下用conda配置pytorch+cuda](https://img.it610.com/image/info8/f5b3f428adb248ff89bf7de6a4618327.jpg)
文章图片
接下来就是静等下载了,