Ubuntu18.04+CUDA+CUDNN+Pytorch环境配置
CUDA
CUDNN
sudo cp cuda/include/cudnn.h /usr/local/cuda-11.4/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-11.4/lib64
sudo chmod a+r /usr/local/cuda-11.4/include/cudnn.h /usr/local/cuda-11.4/lib64/libcudnn*
Conda
conda create -n my_py_env python=3.7
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/bioconda/
- 根据pytorch官网安装,这里注意conda指令中 -c代表指定channel,如果用官网的指令,可能会走国外源
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1
检查上述是否安装成功
import torch
print(torch.cuda.is_available())
from torch.backends import cudnn
print(cudnn.is_available())
Ubuntu18.04 添加用户
sudo useradd -r -m -s /bin/bash test
sudo passwd test