无法在 ubuntu 16.04 上安装 libgtk2.0-dev

无法在 ubuntu 16.04 上安装 libgtk2.0-dev

安装 libgtk2.0-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:
 libgtk2.0-dev : Depends: libglib2.0-dev (>= 2.27.3) but it is not going to be installed
                 Depends: libgdk-pixbuf2.0-dev (>= 2.21.0) but it is not going to be installed
                 Depends: libpango1.0-dev (>= 1.20) but it is not going to be installed
                 Depends: libatk1.0-dev (>= 1.29.2) but it is not going to be installed
                 Depends: libcairo2-dev (>= 1.6.4-6.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我尝试了很多东西,比如 -f 标志、突触,单独安装它们,一次安装所有依赖项,但一切都失败了。

ubuntu 16.04 不支持 libgtk2.0-dev 吗?

编辑:输出apt-cache policy libgtk2.0-dev libglib2.0-dev

libgtk2.0-dev:
  Installed: (none)
  Candidate: 2.24.30-1ubuntu1
  Version table:
     2.24.30-1ubuntu1 500
        500 http://mirror.dhakacom.com/ubuntu-archive xenial/main amd64 Packages
libglib2.0-dev:
  Installed: (none)
  Candidate: 2.48.0-1ubuntu4
  Version table:
     2.48.0-1ubuntu4 500
        500 http://mirror.dhakacom.com/ubuntu-archive xenial/main amd64 Packages

答案1

我如何解决这个问题: 我尝试手动安装这些依赖项。第一次尝试安装,sudo apt-get install libglib2.0-dev但出现以下错误:

The following packages have unmet dependencies:
 libglib2.0-dev : Depends: libglib2.0-0 (= 2.48.0-1ubuntu4) but 2.48.1-1~ubuntu16.04.1 is to be installed
                  Depends: libglib2.0-bin (= 2.48.0-1ubuntu4)

然后我尝试与 glib 一起安装 glibs 依赖项: sudo apt-get install libglib2.0-dev libglib2.0-0=2.48.0-1ubuntu4

这次包安装成功。

之后我发布了sudo apt-get install libgtk2.0-dev并且它起作用了!

答案2

我也遇到了这个问题。但是,由于版本libglib2.0-0现已更改为2.48.2-0ubuntu1(原先是在最初的回答中2.48.0-1ubuntu4),@Reya276,只需相应地更改版本。

完整的解决方案,目前为 16.04 lts, 是:

sudo apt-get install libglib2.0-dev libglib2.0-0=2.48.2-0ubuntu1

相关内容