由于未满足依赖关系,无法安装 libsdl2-dev

由于未满足依赖关系,无法安装 libsdl2-dev

我正在运行 Ubuntu 16.04,我尝试安装 libsdl2-dev,但没有成功。我在 Google 上搜索过,并遵循了此网站和其他网站上的几个答案。我尝试将我的存储库减少到安全的存储库,运行了 apt-get update、apt-get upgrade……还有许多其他我现在记不清的东西。我尝试了在 Google 上能找到的所有方法。这是我从

sudo apt-get -f install libsdl2-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libsdl2-dev : Depends: libudev-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

cat /etc/apt/sources.list
deb http://ftp.belnet.be/ubuntu.com/ubuntu/ xenial multiverse restricted universe main
deb-src http://ftp.belnet.be/ubuntu.com/ubuntu/ xenial multiverse restricted universe main #Added by software-properties

cat /etc/apt/sources.list.d/*

# deb http://ppa.launchpad.net/flexiondotorg/youtube-dl-gui/ubuntu xenial main

# deb-src http://ppa.launchpad.net/flexiondotorg/youtube-dl-gui/ubuntu xenial main

# deb http://ppa.launchpad.net/flexiondotorg/youtube-dl-gui/ubuntu xenial main

# deb-src http://ppa.launchpad.net/flexiondotorg/youtube-dl-gui/ubuntu xenial main

# deb http://deb.playonlinux.com/ trusty main

# deb http://deb.playonlinux.com/ trusty main

deb http://packages.ros.org/ros/ubuntu xenial main

# deb http://packages.ros.org/ros/ubuntu xenial main

# deb http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu xenial main

# deb-src http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu xenial main

# deb-src http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu xenial main

# deb-src http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu xenial main

# deb-src http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu xenial main

# deb-src http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu xenial main

# deb http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu xenial main

# deb-src http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu xenial main

# deb-src http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu xenial main

# deb-src http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu xenial main

# deb-src http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu xenial main

# deb-src http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu xenial main

# deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main

# deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main

# deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main

# deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main

deb http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu xenial main

# deb-src http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu xenial main

deb http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu xenial main

# deb-src http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu xenial main

我也尝试过

y-ppa-manager

synaptic

当我尝试使用 synaptic 安装 libsdl2-dev 时,首先没有损坏的软件包,但是当我标记 libsdl2-dev 进行安装时,它说我必须先删除损坏的软件包。我尝试过 apt-get remove --purge libsdl2-dev,但由于它尚未安装,因此无法删除。

我很感激所有帮助。谢谢。我会发布您给我的命令的输出,并将继续关注这个问题,直到它得到解决。再次感谢

编辑1:

sudo apt-get install libudev-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libudev-dev : Depends: libudev1 (= 229-4ubuntu4) but 229-4ubuntu6 is to be installed
E: Unable to correct problems, you have held broken packages.

sudo apt-get install 229-4ubuntu6
E: Unable to locate package 229-4ubuntu6

sudo apt-get install libudev1
libudev1 is already the newest version (229-4ubuntu6).

编辑2:

对于命令

 sudo add-apt-repository XXXXX

我总是得到

XXXXX distribution component is already enabled for all sources.

其余如下

sudo apt update
Hit:1 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu xenial InRelease
Hit:2 http://packages.ros.org/ros/ubuntu xenial InRelease                      
Hit:3 http://ftp.belnet.be/ubuntu.com/ubuntu xenial InRelease                  
Reading package lists... Done                         
Building dependency tree       
Reading state information... Done
All packages are up to date.

sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

sudo apt -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

sudo apt install libsdl2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libsdl2-dev : Depends: libudev-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

最终编辑:

这个问题现在已解决。我解决问题的最后步骤是启用 xenial-security 和 xenial-update repo。在我完成这些操作并尝试 sudo apt-get update 和 sudo apt-get upgrade 后,我在下载一些更新时遇到了一些错误。之后,我将下载服务器更改为主服务器并重新运行更新和升级,成功完成。之后,我能够成功安装 libsdl2-dev。感谢 doug 和 ali76 的帮助!

答案1

不要尝试这个命令:

sudo apt-get 安装 229-4ubuntu6

E:无法找到软件包 229-4ubuntu6

229-4ubuntu6因为存储库中没有任何具有名称的包。

apt 的输出显示

libudev1 (= 229-4ubuntu4) 但需要安装 229-4ubuntu6

这意味着,229-4ubuntu6的版本libudev1尚未安装,但是229-4ubuntu4需要 版本。

另一件事是, 的最新版本libudev1xenial229-4ubuntu17你的 apt 返回的最新版本是229-4ubuntu6。 发生此问题是因为您的系统上禁用了许多 Ubuntu 存储库,并且您的存储库未更新。

因此,作为第一步,我们尝试使用以下命令启用所有 Ubuntu 存储库:

sudo add-apt-repository main
sudo add-apt-repository universe
sudo add-apt-repository restricted
sudo add-apt-repository multiverse

然后更新您的存储库和包:

sudo apt update
sudo apt upgrade

然后尝试修复损坏的软件包:

sudo apt -f install

最后一步尝试安装libsdl2-dev包:

sudo apt install libsdl2-dev

更新:请将以下行添加到您的/etc/apt/sources.list文件中:

deb http://archive.ubuntu.com/ubuntu xenial universe multiverse
deb-src http://archive.ubuntu.com/ubuntu xenial universe multiverse

deb http://us.archive.ubuntu.com/ubuntu/ xenial universe
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe

deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

deb http://security.ubuntu.com/ubuntu xenial-security universe
deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

并注释掉下面这几行:

deb http://ftp.belnet.be/ubuntu.com/ubuntu/ xenial multiverse restricted universe main
deb-src http://ftp.belnet.be/ubuntu.com/ubuntu/ xenial multiverse restricted universe main #Added by software-properties

然后尝试以下命令来更新存储库和包:

sudo apt update
sudo apt upgrade

然后尝试再次安装:

sudo apt install libsdl2-dev

相关内容