首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ubuntu18.04.2安装python2.7,未满足依赖性

Ubuntu18.04.2安装python2.7,未满足依赖性
EN

Ask Ubuntu用户
提问于 2019-09-14 21:50:53
回答 1查看 12.7K关注 0票数 3

我无法在我的ubuntu18.04.2上安装python2,下面是我所做的:

代码语言:javascript
复制
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.

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

代码语言:javascript
复制
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.

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

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

代码语言:javascript
复制
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

然后我换了一个软件来源并更新了一些东西。它起作用了。

代码语言:javascript
复制
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
EN

回答 1

Ask Ubuntu用户

发布于 2019-12-04 10:08:05

您只需卸载已经安装的python2包,如下所示:

sudo apt purge libpython2*

然后安装python2:

sudo apt install python

票数 6
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1174213

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档