gpt4 book ai didi

ubuntu - 如何从 ubuntu 中完全删除 cuda?

转载 作者:行者123 更新时间:2023-12-04 11:05:01 28 4
gpt4 key购买 nike

我有 ubuntu 18.04,不小心安装了 cuda 9.1 来运行 Tensorflow-gpu,但似乎 tensorflow-gpu 需要 cuda 10.0,所以我想先通过执行删除 cuda:

martin@nlp-server:~$ sudo apt-get remove --auto-remove nvidia-cuda-toolkit
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
cuda-libraries-dev-10-1 : Depends: libcublas-dev (>= 10.2.0.168) but 10.1.0.105-1 is to be installed
cuda-samples-10-1 : Depends: libcublas-dev (>= 10.2.0.168) but 10.1.0.105-1 is to be installed
cuda-visual-tools-10-1 : Depends: libcublas-dev (>= 10.2.0.168) but 10.1.0.105-1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

然后我尝试运行“apt --fix-broken install”,但出现以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libcublas-dev
The following packages will be upgraded:
libcublas-dev
1 upgraded, 0 newly installed, 0 to remove and 145 not upgraded.
69 not fully installed or removed.
Need to get 0 B/39.1 MB of archives.
After this operation, 3,458 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 253408 files and directories currently installed.)
Preparing to unpack .../libcublas-dev_10.2.0.168-1_amd64.deb ...

Unpacking libcublas-dev (10.2.0.168-1) over (10.1.0.105-1) .........................................................................................................................................................................................................................................................]
dpkg: error processing archive /var/cache/apt/archives/libcublas-dev_10.2.0.168-1_amd64.deb (--unpack):
trying to overwrite '/usr/lib/x86_64-linux-gnu/libcublas_static.a', which is also in package nvidia-cuda-dev 9.1.85-3ubuntu1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libcublas-dev_10.2.0.168-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

如何完全删除cuda?

最佳答案

您可能想要删除两件事——nvidia 驱动程序和 cuda 工具包。
如果您使用 安装易于获取 使用以下命令从系统中完全删除软件包:
要删除 cuda 工具包:

sudo apt-get --purge remove "*cublas*" "cuda*" "nsight*" 
要删除 Nvidia 驱动程序:
sudo apt-get --purge remove "*nvidia*"
如果您通过 安装源文件 (假设默认位置为 /usr/local )然后使用以下命令将其删除:
sudo rm -rf /usr/local/cuda*
从 cuda 11.4 开始,提供了一个卸载程序脚本。将其用于卸载:
# To uninstall cuda
sudo /usr/local/cuda-11.4/bin/cuda-uninstaller
# To uninstall nvidia
sudo /usr/bin/nvidia-uninstall
如果遇到 的问题破损的包裹 ,自从您将 repo 添加到 apt/sources.lst 后,它就发生了。运行以下命令将其删除:
sudo vim /etc/apt/sources.list
转到包含对 Nvidia repo 的引用的行并通过附加 # 对其进行评论排在前面,例如:
#deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /
然后运行
sudo apt-get update 
这将解决问题。
引用文献: Nvidia uninstallation

关于ubuntu - 如何从 ubuntu 中完全删除 cuda?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56431461/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com