ubuntu cudnn deb安装
时间: 2024-10-02 20:03:56 浏览: 35
Ubuntu系统上安装CUDA和cuDNN通常需要几个步骤,因为它们不是标准包管理器apt的一部分。以下是安装CUDA和cuDNN的基本流程:
1. **更新系统**:
```sh
sudo apt update && sudo apt upgrade
```
2. **安装依赖**:
对于CUDA,你需要先安装一些必要的库:
```sh
sudo apt install build-essential cmake libncurses5-dev libssl-dev libudev-dev libx11-dev libcurl4-openssl-dev libgl1-mesa-dev libopenblas-dev
```
3. **下载CUDA**:
访问NVIDIA官网下载CUDA Toolkit(https://www.nvidia.com/en-us/cuda-downloads),选择适用于Ubuntu的版本并下载。
4. **添加NVIDIA GPG密钥**:
```sh
curl https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | sudo apt-key add -
```
5. **添加CUDA repository到sources.list.d**:
```
echo "deb [arch=amd64] http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list
```
6. **安装CUDA**:
```sh
sudo apt-get update
sudo apt-get install cuda
```
7. **安装cuDNN**:
首先,访问cuDNN官网(https://developer.nvidia.com/cudnn)下载cuDNN针对CUDA版本的对应版本。解压后将`cuda/include`、`cuda/lib64`等文件夹复制到CUDA的include和lib路径下。
8. **配置环境变量**:
编辑`~/.bashrc`或`~/.bash_profile`加入以下内容:
```sh
export CUDA_HOME=/usr/local/cuda
export CUDNN_INCLUDE_DIR=$CUDA_HOME/include
export CUDNN_LIBRARY_PATH=$CUDA_HOME/lib64
source ~/.bashrc
```
9. **验证安装**:
```sh
nvidia-smi
```
阅读全文