我正在使用 Ubuntu 22.04。不知何故,每当我尝试在 Ubuntu 中安装软件包时,都会收到此错误
libjpeg-dev : Depends: libjpeg62-turbo-dev (>= 1:1.5.2-2+deb10u1) but it is not going to be installed
所以我尝试了sudo apt -f install
但我得到了
dpkg: error processing archive /var/cache/apt/archives/libjpeg62-turbo-dev_1%3a1.5.2-2+deb10u1_amd64.deb (--unpack):
trying to overwrite '/usr/include/jerror.h', which is also in package libjpeg-turbo8-dev:amd64 2.1.2-0ubuntu1
我尝试删除 libjpeg8,但出现错误
sudo apt-get remove libjpeg-turbo8-dev
The following packages have unmet dependencies:
libjpeg-dev : Depends: libjpeg62-turbo-dev (>= 1:1.5.2-2+deb10u1) but it is not going to be installed
我尝试安装 libjpeg62
sudo apt-get install libjpeg62-turbo-dev
dpkg: error processing archive /var/cache/apt/archives/libjpeg62-turbo-dev_1%3a1.5.2-2+deb10u1_amd64.deb (--unpack):
trying to overwrite '/usr/include/jerror.h', which is also in package libjpeg-turbo8-dev:amd64 2.1.2-0ubuntu1
我尝试安装 aptitude,因为它据说能够解决软件包冲突,但出现了同样的错误
sudo apt-get install aptitude
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
aptitude : Depends: aptitude-common (= 0.8.13-3ubuntu1) but it is not going to be installed
Depends: libcwidget4 (>= 0.5.18-1) but it is not going to be installed
Depends: libxapian30 (>= 1.4.17~) but it is not going to be installed
libjpeg-dev : Depends: libjpeg62-turbo-dev (>= 1:1.5.2-2+deb10u1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
我尝试运行时的输出dpkg --configure
sudo dpkg --configure -a && sudo apt clean
dpkg: dependency problems prevent configuration of libjpeg-dev:
libjpeg-dev depends on libjpeg62-turbo-dev (>= 1:1.5.2-2+deb10u1); however:
Package libjpeg62-turbo-dev:amd64 is not installed.
dpkg: error processing package libjpeg-dev (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
libjpeg-dev
基本上,我的系统中现在 libjpeg8 和 libjpeg62 存在无法修复的冲突。我该怎么做才能解决这个问题?
答案1
解决方案是通过运行来删除
sudo apt-get remove libjpeg-dev
之后我可以正常进行软件包安装