我无法在我的ubuntu18.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.因此,一步一步地,我发现源问题是我无法在我的笔记本电脑上安装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.有人知道如何解决这个问题吗?
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然后我换了一个软件来源并更新了一些东西。它起作用了。
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发布于 2019-12-04 10:08:05
您只需卸载已经安装的python2包,如下所示:
sudo apt purge libpython2*
然后安装python2:
sudo apt install python
https://askubuntu.com/questions/1174213
复制相似问题