我卸载了系统上的 nvidia 驱动程序:
$ sudo apt --purge remove nvidia-driver-470
但有一个包裹仍然孤零零的:
$ apt list --installed | grep nvidia
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libnvidia-compute-470/jammy,now 470.239.06-1pop0~1710862379~22.04~5a92c99 amd64 [installed,automatic]
如果我理解正确,使用apt rdepends
将显示另一个包是否依赖于这个包:
$ sudo apt rdepends libnvidia-compute-470
[sudo] password for david:
libnvidia-compute-470
Reverse Depends:
Depends: libnvidia-decode-470 (= 470.256.02-0ubuntu0.22.04.1)
Depends: nvidia-utils-470
Depends: nvidia-headless-no-dkms-470 (= 470.256.02-0ubuntu0.22.04.1)
Depends: nvidia-driver-470 (= 470.256.02-0ubuntu0.22.04.1)
Depends: nvidia-compute-utils-470
Depends: libnvidia-decode-470 (= 470.103.01-0ubuntu2)
Replaces: libnvidia-compute-470 (<< 390.25-0ubuntu2~)
Depends: libnvidia-compute-465
Depends: libnvidia-compute-460
Depends: nvidia-utils-470
Depends: nvidia-headless-no-dkms-470 (= 470.103.01-0ubuntu2)
Depends: nvidia-driver-470 (= 470.103.01-0ubuntu2)
Depends: nvidia-compute-utils-470
Replaces: libnvidia-compute-470 (<< 390.25-0ubuntu2~)
Replaces: libnvidia-compute-470 (<< 390.25-0ubuntu2~)
Depends: libnvidia-compute-465
Depends: libnvidia-compute-460
Depends: nvidia-utils-470
Depends: nvidia-headless-no-dkms-470 (= 470.239.06-1pop0~1710862379~22.04~5a92c99)
Depends: nvidia-driver-470 (= 470.239.06-1pop0~1710862379~22.04~5a92c99)
Depends: nvidia-compute-utils-470
Depends: libnvidia-decode-470 (= 470.239.06-1pop0~1710862379~22.04~5a92c99)
Depends: libnvidia-compute-430
Depends: libnvidia-compute-465
Depends: libnvidia-compute-460
Depends: libnvidia-compute-455
Depends: libnvidia-compute-450
Depends: libnvidia-compute-440
因此,如果我的解释正确,则只有其他 nvidia 软件包依赖于此软件包,并且没有安装其他 nvidia 软件包,那么为什么它仍然存在?apt
偶尔会错过一些东西吗?使用 删除此软件包安全吗sudo apt remove libnvidia-compute-470
?
编辑:这个问题并不是关于如何卸载 nvidia 驱动程序。它更多的是关于为什么 apt 会这样表现。
将清除该
nvidia-driver-470
包以及任何依赖于该包的包(并且在清除之前,它会告诉您这些包是什么(如果有))。它不会删除依赖的软件包
nvidia-driver-470
,即使删除nvidia-driver-470
意味着不再需要它们。这就是为什么libnvidia-compute-470
被留下的原因。要删除不再需要的软件包(假设它们被标记为自动安装(它们应该是),您需要运行
sudo apt autoremove
(或sudo apt autopurge
),或者--autoremove
在运行时指定选项sudo apt remove
:请注意,这将删除所有被视为不必要的包(也就是说,标记为自动安装但不再依赖的包),而不仅仅是那些由于删除而变得不必要的包
nvidia-driver-470
。要完全删除 nvidia 驱动程序,请使用: