WSL Ubuntu cuda 安装搞砸了

WSL Ubuntu cuda 安装搞砸了

尝试安装 sklearn 时出现错误:

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-drivers : Depends: nvidia-418 (>= 418.40.04) but it is not going to be installed

 libcuda1-418 : Depends: nvidia-418 (>= 418.40.04) but it is not going to be installed

 nvidia-418-dev : Depends: nvidia-418 (>= 418.40.04) but it is not going to be installed

 nvidia-opencl-icd-418 : Depends: nvidia-418 (>= 418.40.04) but it is not going to be installed

 python-sklearn : Depends: python-numpy but it is not going to be installed
                  Depends: python-scipy but it is not going to be installed
                  Depends: python-sklearn-lib (>= 0.19.1-3) but it is not going to be installed

                  Depends: python-joblib (>= 0.9.2) but it is not going to be installed

                  Recommends: python-nose but it is not going to be installed
                  Recommends: python-pytest but it is not going to be installed
                  Recommends: python-matplotlib but it is not going to be installed

E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

我尝试过sudo apt --fix-broken install,但是我得到:

Unpacking nvidia-418 (418.40.04-0ubuntu1) ...

dpkg: error processing archive /var/cache/apt/archives/nvidia-418_418.40.04-0ubuntu1_amd64.deb (--unpack):

 trying to overwrite '/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0', which is also in package libglx-mesa0:amd64 18.2.2-0ubu ntu1~18.04.2

Errors were encountered while processing:

 /var/cache/apt/archives/nvidia-418_418.40.04-0ubuntu1_amd64.deb

E: Sub-process /usr/bin/dpkg returned an error code (1)

还尝试清除 nvidia-418 或依赖它的软件包,sudo apt-get remove --purge getdeb-repository但无济于事。我该如何处理?

答案1

似乎 apt 阻止您--fix执行此操作,因为您有一个被两个不同包使用的包,因此出现“试图覆盖”消息。这个答案来自@AvinashRaj解释导致错误的原因。

从上面的错误报告中可以清楚地看到,在运行sudo apt-get install -f命令时dpkg尝试提取并安装 .deb文件 1. 安装需要放置package_file_A/usr/bin目录上。

但看到同样的东西时它很震惊package_file_A 目录中的文件/usr/bin并产生错误,因为此文件是/usr/bin在安装过程中放置​​的some_package

我改了几个字,所有功劳都归于https://askubuntu.com/a/430443/253251

该怎么办 ?

对于肮脏的黑客,您可以尝试强制覆盖有问题的文件,但要小心。

sudo dpkg -i --force-overwrite /var/cache/apt/archives/nvidia-418_418.40.04-0ubuntu1_amd64.deb

然后您可以尝试修复剩余的问题。

sudo apt -f install

相关内容