Я не могу установить python2 на свой Ubuntu 18.04.2, вот что я сделал:
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
вам просто нужно удалить уже установленные пакеты python2 с помощью этого:
sudo apt purge libpython2 *
Затем установите python2:
sudo apt install python