上周电脑重启后,我的 Ubuntu 18.04 LTS 系统突然忘记了有关显示器的所有信息,只为“未知”显示器生成了图像,因此我删除了与 NVIDIA 相关的所有内容,包括 CUDA 和 cuDNN(我需要在 GPU 上运行 TensorFlow),并尝试从头开始重新安装所有内容。我成功重新安装了 GPU 驱动程序并保留了我的显示器设置。
但是,我在安装 CUDA 时遇到了问题。当我运行
sudo apt-get install cuda-toolkit-10-0
我明白了
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package cuda-toolkit-10-0 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'cuda-toolkit-10-0' has no installation candidate
这很奇怪,因为我认为这是我以前安装 CUDA 时使用的命令(虽然我不记得上次是什么让 CUDA 最终工作)。所以我尝试找到包指的是cuda-toolkit-10-0
运行
apt-cache search cuda-toolkit-10-0
但这并没有输出任何东西(如果链接问题中所述的是正确的,这也很奇怪)。
我也尝试从 NVIDIA 的 CUDA Toolkit 存档页面开始,并按照以下说明进行操作安装本地 deb 文件:
$ sudo dpkg -i cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
[sudo] password for kristofer:
(Reading database ... 249237 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64.deb ...
Unpacking cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48 (1.0-1) over (1.0-1) ...
Setting up cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48 (1.0-1) ...
$ sudo apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub
OK
$ sudo apt-get update
Hit:1 http://se.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://linux.teamviewer.com/deb stable InRelease
Hit:3 http://se.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://se.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:6 http://ppa.launchpad.net/jonathonf/gcc-7.3/ubuntu bionic InRelease
Hit:7 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:8 http://repository.spotify.com stable InRelease
Hit:9 http://archive.canonical.com/ubuntu bionic InRelease
Hit:10 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Reading package lists... Done
$ sudo apt-get install cuda
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package cuda
所以 apt-get 无法找到包 cuda。
那么,如何安装 CUDA 10.0?