无法在Ubuntu 12.04.2 LTS上安装python2.7-dev

命令$ sudo apt-get install python2.7-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: python2.7-dev : Depends: libexpat1-dev but it is not going to be installed E: Unable to correct problems, you have held broken packages. 

在运行安装命令之前,我运行了sudo apt-get updatesudo apt-get upgradesudo apt-get dist-upgrade 。 我已经尝试从我的本地服务器(捷克共和国)切换到主服务器的存储库服务器。 我已经尝试使用aptitude安装软件包,结果是:

 The following NEW packages will be installed: libexpat1-dev{ab} libssl-dev{a} libssl-doc{a} python2.7-dev 0 packages upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 32.4 MB of archives. After unpacking 47.9 MB will be used. The following packages have unmet dependencies: libexpat1-dev : Depends: libexpat1 (= 2.0.1-7.2ubuntu1.1) but 2.1.0-1ubuntu1 is installed. The following actions will resolve these dependencies: Keep the following packages at their current version: 1) libexpat1-dev [Not Installed] 2) python2.7-dev [Not Installed] Accept this solution? [Y/n/q/?] Y No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B of archives. After unpacking 0 B will be used. 

天赋的build议“解决scheme”实际上没有做任何事情,也没有效果。 打印完上面的内容后,它不存在错误代码或任何错误消息。

我已经尝试删除libexpat1,但我需要太多的包依赖于它,包括,似乎,巨大的GNOME块。

我试过的东西没有任何效果,安装命令的结果仍然是一样的。

我已经在networking上search了这个问题,发现了几个似乎与我的问题有关的post,但是虽然他们可能被“解决”了,但是他们没有任何一个帮助我(这里是我之前没有提到的两个问题这个问题):

  1. 无法安装python2.7-dev由于未满足的依赖Ubuntu 12.04
  2. https://askubuntu.com/questions/275861/problem-installing-python-dev

这里有趣的是:

 libexpat1-dev : Depends: libexpat1 (= 2.0.1-7.2ubuntu1.1) but 2.1.0-1ubuntu1 is installed. 

根据在线包search工具 , 12.04 LTS发布了libexpat1 2.0.1-7.2ubuntu1.1版本,用于preciseprecise-updates 。 问题是,你是如何获得版本2.1.0-1ubuntu1安装在第一位?

使用aptitude()交互式用户界面,您可以searchlibexpat1 ,并select适当的版本进行安装,即将软件包降级以匹配libexpat1-dev依赖项。

你也可以通过命令行来做到这一点:

 sudo aptitude install package=version