Ubuntu 23.10环境下CUDA与cuDNN安装启用及版本适配问题咨询
Ubuntu 23.10环境下CUDA与cuDNN安装启用及版本适配问题咨询
Hey there, I’ve run into this exact problem on Ubuntu 23.10 myself—since NVIDIA hasn’t released official packages for Mantic Minotaur yet, here are three reliable workarounds to get CUDA and cuDNN up and running smoothly:
1. 兼容安装Ubuntu 22.04的CUDA Toolkit包
This is the most straightforward method for system-wide installation:
- First, confirm the CUDA version your GPU supports (check NVIDIA’s official specs if you’re unsure), then download the Ubuntu 22.04 (Jammy) deb package for that version.
- Install the CUDA keyring first:
sudo dpkg -i cuda-keyring_*.deb - Edit the CUDA source list to match Ubuntu 23.10’s codename (
mantic):
Open/etc/apt/sources.list.d/cuda-*.listwith your favorite editor, replace every instance ofjammywithmantic. - Update your apt cache and install CUDA:
sudo apt update sudo apt install cuda - Add environment variables to your shell config (
.bashrcor.zshrc):echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc source ~/.bashrc
2. 使用Runfile手动安装(避免系统依赖冲突)
If you run into dependency issues with the deb package, go for the runfile:
- Download the CUDA Toolkit runfile for Linux x86_64 (again, pick the version compatible with your GPU).
- Switch to multi-user mode to avoid GUI conflicts during installation:
sudo systemctl set-default multi-user.target sudo reboot - Log into the command line, navigate to the download folder, and run the installer:
sudo sh cuda_*.run - In the installation wizard, uncheck "Driver Installation"—Ubuntu 23.10’s kernel usually includes a newer NVIDIA driver that works better with the system. Only keep "CUDA Toolkit" and "CUDA Samples" checked.
- Reboot back to GUI mode and add the same environment variables as method 1.
3. Conda安装(适合Python机器学习场景)
If you’re mainly using CUDA for Python-based ML/DL, Conda handles compatibility automatically:
- Create a new Conda environment (adjust Python version as needed):
conda create -n cuda_env python=3.10 conda activate cuda_env - Install CUDA Toolkit and cuDNN directly via Conda:
conda install cudatoolkit cudnn - Verify with a quick test (e.g., for PyTorch):
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia python -c "import torch; print(torch.cuda.is_available())"
安装cuDNN(通用步骤)
No matter which method you use for CUDA, installing cuDNN is similar:
- Download the cuDNN tar package that matches your installed CUDA version.
- Extract the tar file and copy the files to your CUDA directory:
tar -xzvf cudnn-*.tar.xz sudo cp cudnn-*-include/cudnn*.h /usr/local/cuda/include sudo cp -P cudnn-*-lib64/libcudnn* /usr/local/cuda/lib64 sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
验证安装成功
- Check CUDA version:
nvcc --version - Check cuDNN version:
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2 - Run the CUDA device query sample to confirm GPU detection:
cd /usr/local/cuda/samples/1_Utilities/deviceQuery make ./deviceQuery
If you see your GPU’s details and a "Result = PASS" message, you’re good to go!
备注:内容来源于stack exchange,提问作者Jjay
相关产品推荐
相关产品推荐

