Ubuntu 18.04.2 安装 python2.7,未满足的依赖

bo *_*ang 3 python apt dependencies 18.04

我无法在 ubuntu 18.04.2 上安装 python2,以下是我所做的:

bo@ubuntu18:~$ sudo apt install python
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 resolve the situation:

The following packages have unmet dependencies:
 python : PreDepends: python-minimal (= 2.7.15~rc1-1) but it is not going to be installed
          Depends: python2.7 (>= 2.7.15~rc1-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)

所以一步一步,我发现源问题是我无法在我的笔记本电脑上安装libpython2.7:

The following packages have unmet dependencies:
 python2.7-minimal : Depends: libpython2.7-minimal (= 2.7.15~rc1-1) but 2.7.15~rc1-1ubuntu0.1 is to be installed
                     Recommends: python2.7 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)

有谁知道如何解决这个问题?


的输出 apt-cache policy python libpython2.7-minimal

bo@ubuntu18:~$ apt-cache policy python libpython2.7-minimal
python:
  Installed: (none)
  Candidate: 2.7.15~rc1-1
  Version table:
     2.7.15~rc1-1 500
        500 http://mirror.clibre.uqam.ca/ubuntu bionic/main amd64 Packages
libpython2.7-minimal:
  Installed: 2.7.15~rc1-1ubuntu0.1
  Candidate: 2.7.15~rc1-1ubuntu0.1
  Version table:
 *** 2.7.15~rc1-1ubuntu0.1 100
        100 /var/lib/dpkg/status
     2.7.15~rc1-1 500
        500 http://mirror.clibre.uqam.ca/ubuntu bionic/main amd64 Packages
Run Code Online (Sandbox Code Playgroud)

然后我更改了一个软件源并更新了一些东西。有用。

bo@ubuntu18:~$ apt-cache policy python libpython2.7-minimal
python:
  Installed: 2.7.15~rc1-1
  Candidate: 2.7.15~rc1-1
  Version table:
 *** 2.7.15~rc1-1 500
        500 http://ca.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status
libpython2.7-minimal:
  Installed: 2.7.15-4ubuntu4~18.04.1
  Candidate: 2.7.15-4ubuntu4~18.04.1
  Version table:
 *** 2.7.15-4ubuntu4~18.04.1 500
        500 http://ca.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://ca.archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages
        100 /var/lib/dpkg/status
     2.7.15~rc1-1 500
        500 http://ca.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Run Code Online (Sandbox Code Playgroud)

小智 5

你只需要卸载已经安装的 python2 包:

sudo apt purge libpython2*

然后安装 python2 :

sudo apt install python


归档时间:

查看次数:

6971 次

最近记录:

6 年,9 月 前