由于对 Ubuntu 16.04 的依赖,无法安装 python-dev

由于对 Ubuntu 16.04 的依赖,无法安装 python-dev

我该如何解决这个问题(不损坏我的电脑!)?我想python-dev在我的 Ubuntu 上安装。我已经试过了aptitude,但没用。

$ sudo apt-get install libexpat1-dev libpython-dev libpython2.7-dev python-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:
 libexpat1-dev : Depends: libexpat1 (= 2.1.0-7) but 2.1.0-7ubuntu0.16.04.2 is to be installed
 libpython2.7-dev : Depends: libpython2.7-stdlib (= 2.7.11-7ubuntu1) but 2.7.12-1ubuntu0~16.04.1 is to be installed
                    Depends: libpython2.7 (= 2.7.11-7ubuntu1) but 2.7.12-1ubuntu0~16.04.1 is to be installed
 python-dev : Depends: python2.7-dev (>= 2.7.11-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

额外的:

$ apt policy libexpat1-dev
libexpat1-dev:
  Installed: (none)
  Candidate: 2.1.0-7
  Version table:
     2.1.0-7 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
$ grep "^deb " /etc/apt/sources.li
st
deb http://archive.ubuntu.com/ubuntu xenial main restricted
deb http://archive.ubuntu.com/ubuntu xenial universe
deb http://archive.ubuntu.com/ubuntu xenial multiverse
deb http://archive.canonical.com/ubuntu xenial partner
$ apt policy python2.7-dev
python2.7-dev:
  Installed: (none)
  Candidate: 2.7.11-7ubuntu1
  Version table:
     2.7.11-7ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages

答案1

看来您在启用时没有重要的存储库sources.list

添加此行:

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

/etc/apt/sources.list,然后使用sudo apt update

它应该可以解决问题。

相关内容