我尝试安装 cuda 9.0 而不是 cuda 9.2,因为 tensorflow 与它不兼容。我尝试了以下操作:
aims@aims:~/Downloads$ sudo dpkg -i "cuda-repo-ubuntu1604_9.0.176-1_amd64(1).deb"
(Reading database ... 212533 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1604_9.0.176-1_amd64(1).deb ...
Unpacking cuda-repo-ubuntu1604 (9.0.176-1) over (9.0.176-1) ...
Setting up cuda-repo-ubuntu1604 (9.0.176-1) ...
aims@aims:~/Downloads$ sudo apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Ign:2 http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 InRelease
Hit:3 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu xenial InRelease
Hit:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:5 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:6 http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 Release
Hit:8 http://dl.google.com/linux/chrome/deb stable Release
Hit:9 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:11 http://archive.canonical.com xenial InRelease
Hit:12 http://ppa.launchpad.net/nemh/systemback/ubuntu xenial InRelease
Reading package lists... Done
aims@aims:~/Downloads$ sudo apt-get install cuda
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
cuda-9-2 cuda-command-line-tools-9-2 cuda-compiler-9-2 cuda-cublas-9-2 cuda-cublas-dev-9-2 cuda-cudart-9-2 cuda-cudart-dev-9-2 cuda-cufft-9-2 cuda-cufft-dev-9-2 cuda-cuobjdump-9-2 cuda-cupti-9-2 cuda-curand-9-2 cuda-curand-dev-9-2 cuda-cusolver-9-2 cuda-cusolver-dev-9-2
cuda-cusparse-9-2 cuda-cusparse-dev-9-2 cuda-demo-suite-9-2 cuda-documentation-9-2 cuda-driver-dev-9-2 cuda-drivers cuda-gdb-9-2 cuda-gpu-library-advisor-9-2 cuda-libraries-9-2 cuda-libraries-dev-9-2 cuda-license-9-2 cuda-memcheck-9-2 cuda-misc-headers-9-2 cuda-npp-9-2
cuda-npp-dev-9-2 cuda-nsight-9-2 cuda-nvcc-9-2 cuda-nvdisasm-9-2 cuda-nvgraph-9-2 cuda-nvgraph-dev-9-2 cuda-nvml-dev-9-2 cuda-nvprof-9-2 cuda-nvprune-9-2 cuda-nvrtc-9-2 cuda-nvrtc-dev-9-2 cuda-nvtx-9-2 cuda-nvvp-9-2 cuda-runtime-9-2 cuda-samples-9-2 cuda-toolkit-9-2
cuda-tools-9-2 cuda-visual-tools-9-2
The following NEW packages will be installed:
cuda cuda-9-2 cuda-command-line-tools-9-2 cuda-compiler-9-2 cuda-cublas-9-2 cuda-cublas-dev-9-2 cuda-cudart-9-2 cuda-cudart-dev-9-2 cuda-cufft-9-2 cuda-cufft-dev-9-2 cuda-cuobjdump-9-2 cuda-cupti-9-2 cuda-curand-9-2 cuda-curand-dev-9-2 cuda-cusolver-9-2
cuda-cusolver-dev-9-2 cuda-cusparse-9-2 cuda-cusparse-dev-9-2 cuda-demo-suite-9-2 cuda-documentation-9-2 cuda-driver-dev-9-2 cuda-drivers cuda-gdb-9-2 cuda-gpu-library-advisor-9-2 cuda-libraries-9-2 cuda-libraries-dev-9-2 cuda-license-9-2 cuda-memcheck-9-2
cuda-misc-headers-9-2 cuda-npp-9-2 cuda-npp-dev-9-2 cuda-nsight-9-2 cuda-nvcc-9-2 cuda-nvdisasm-9-2 cuda-nvgraph-9-2 cuda-nvgraph-dev-9-2 cuda-nvml-dev-9-2 cuda-nvprof-9-2 cuda-nvprune-9-2 cuda-nvrtc-9-2 cuda-nvrtc-dev-9-2 cuda-nvtx-9-2 cuda-nvvp-9-2 cuda-runtime-9-2
cuda-samples-9-2 cuda-toolkit-9-2 cuda-tools-9-2 cuda-visual-tools-9-2
0 upgraded, 48 newly installed, 0 to remove and 4 not upgraded.
Need to get 0 B/1,145 MB of archives.
After this operation, 2,642 MB of additional disk space will be used.
Do you want to continue? [Y/n]
如您所见,尽管我没有添加 Cuda 9.2,但它却无处不在。之前我添加了它,但在升级到 9.0 之前,我已清除了 cuda 9.2。但在安装时遇到问题。请帮帮我。
答案1
仓库http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/包含9.0、9.1和9.2。
运行时sudo apt install cuda
它会自动选择最新版本。相反,你应该在安装过程中指定版本:
sudo apt install cuda-9-0
然后在安装后将其保留,以便将来运行时它不会尝试将其升级到该存储库中的最新版本sudo apt upgrade
:
sudo apt hold cuda-9-0
我已经整理出在 16.04 中安装所有 3 个 CUDA 版本的答案https://askubuntu.com/a/1025949/231142
答案2
当你安装cuda-repo-ubuntu1604_9.0.176-1_amd64(1).deb
文件时,它会将其存储库添加到/etc/apt/sources.list.d
目录中。转到 sources.list.d 目录并删除它们。
sudo rm /etc/apt/sources.list.d/cuda*
sudo apt update
现在它不会更新到v9.2