Установлен самокомпилированный Python 3.7.0 как «python», как его удалить?

Я совершил огромную ошибку на своем сервере Ubuntu 16.04.

Я скомпилировал и установил Python 3.7.0 из исходников, используя make altinstall , но я не включил все необходимые мне основные зависимости, поэтому собирался удалить его и установить вместо него предварительно упакованный deb.

Однако, чтобы удалить его, я использовал этот метод с помощью checkinstall . Я создал deb, чтобы затем удалить все файлы, созданные при исходной установке, но для имени пакета deb я просто оставил значение по умолчанию python .

Теперь,У меня установлен следующий пакет:

$ sudo dpkg -l python
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                  Version                         Architecture                    Description
+++-=====================================================-===============================-===============================-===============================================================================================================
ri  python                                                3.7.0-1                         amd64                           Package created with checkinstall 1.6.2

Это означает, что я не могу запустить dpkg -r python , потому что системные пакеты зависят от метапакета, только что названного python :

$ sudo dpkg -r python
dpkg: dependency problems prevent removal of python:
 python-ldb depends on python (<< 2.8).
 python-ldb depends on python (>= 2.7~).
 python-ldb depends on python (<< 2.8).
 python-ldb depends on python (>= 2.7~).
 python-ldb depends on python (<< 2.8).
 python-ldb depends on python (>= 2.7~).
 python-talloc depends on python (<< 2.8).
 python-talloc depends on python (>= 2.7~).
 python-talloc depends on python (<< 2.8).
 python-talloc depends on python (>= 2.7~).
 python-pyicu depends on python (>= 2.7).
 python-pyicu depends on python (<< 2.8).
 python-pyicu depends on python (>= 2.7).
 python-pyicu depends on python (<< 2.8).
 samba-common-bin depends on python.
 samba depends on python (>= 2.7).
 samba depends on python (<< 2.8).
 samba depends on python (>= 2.7).
 samba depends on python (<< 2.8).
 iotop depends on python (>= 2.7.1-0ubuntu2).
 iotop depends on python (<< 2.8).
 iotop depends on python (>= 2.7.1-0ubuntu2).
 iotop depends on python (<< 2.8).
 python-cryptography depends on python (<< 2.8).
 py
dpkg: error processing package python (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 python

И я не могу установить снова версия python по умолчанию, потому что у меня установлена ​​неправильная версия для python :

$ sudo apt install python
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python is already the newest version (3.7.0-1).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 iotop : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-acme : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
 python-asn1crypto : Depends: python:any (< 2.8)
                     Depends: python:any (>= 2.7.5-5~)
 python-certifi : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-cffi-backend : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-chardet : Depends: python:any (< 2.8)
                  Depends: python:any (>= 2.7.5-5~)
 python-configparser : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-crypto : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                 Depends: python:any (>= 2.7.5-5~)
 python-cryptography : Depends: python (< 2.8) but 3.7.0-1 is to be installed
                       Depends: python:any (>= 2.7.5-5~)
 python-dnspython : Depends: python:any (< 2.8)
                    Depends: python:any (>= 2.7.5-5~)
 python-enum34 : Depends: python:any (< 2.8)
                 Depends: python:any (>= 2.7.5-5~)
 python-funcsigs : Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
 python-future : Depends: python:any (< 2.8)
                 Depends: python:any (>= 2.7.5-5~)
 python-idna : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
 python-ipaddress : Depends: python:any (< 2.8)
                    Depends: python:any (>= 2.7.5-5~)
 python-josepy : Depends: python:any (< 2.8)
                 Depends: python:any (>= 2.7.5-5~)
 python-ldb : Depends: python (< 2.8) but 3.7.0-1 is to be installed
              Depends: python:any (>= 2.7.5-5~)
 python-mock : Depends: python:any (< 2.8)
               Depends: python:any (>= 2.7.5-5~)
 python-openssl : Depends: python:any (< 2.8)
                  Depends: python:any (>= 2.7.5-5~)
 python-parsedatetime : Depends: python:any (< 2.8)
                        Depends: python:any (>= 2.7.5-5~)
 python-pbr : Depends: python:any (< 2.8)
              Depends: python:any (>= 2.7.5-5~)
 python-pkg-resources : Depends: python:any (< 2.8)
                        Depends: python:any (>= 2.7.5-5~)
 python-pyicu : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-requests : Depends: python:any (< 2.8)
                   Depends: python:any (>= 2.7.5-5~)
 python-requests-toolbelt : Depends: python:any (< 2.8)
                            Depends: python:any (>= 2.7.5-5~)
 python-rfc3339 : Depends: python:any (< 2.8)
                  Depends: python:any (>= 2.7.5-5~)
 python-samba : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-setuptools : Depends: python:any (< 2.8)
                     Depends: python:any (>= 2.7.5-5~)
 python-six : Depends: python:any (< 2.8)
              Depends: python:any (>= 2.7.5-5~)
 python-talloc : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-tdb : Depends: python (< 2.8) but 3.7.0-1 is to be installed
              Depends: python:any (>= 2.7.5-5~)
 python-tz : Depends: python (< 2.8) but 3.7.0-1 is to be installed
 python-urllib3 : Depends: python:any (< 2.8)
                  Depends: python:any (>= 2.7.5-5~)
 samba : Depends: python (< 2.8) but 3.7.0-1 is to be installed
         Recommends: attr but it is not going to be installed
         Recommends: samba-dsdb-modules but it is not going to be installed
         Recommends: samba-vfs-modules but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Запуск меня пугает, поэтому я выбрал «нет»:

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
  iotop python-acme python-asn1crypto python-certifi python-cffi-backend python-chardet python-configparser python-crypto python-cryptography python-dnspython python-enum34 python-funcsigs python-future python-idna python-ipaddress
  python-josepy python-ldb python-mock python-openssl python-parsedatetime python-pbr python-pkg-resources python-pyicu python-requests python-requests-toolbelt python-rfc3339 python-samba python-setuptools python-six python-talloc
  python-tdb python-tz python-urllib3 samba samba-common-bin samba-libs
0 upgraded, 0 newly installed, 36 to remove and 0 not upgraded.
After this operation, 56.7 MB disk space will be freed.
Do you want to continue? [Y/n]

Есть ли способ исправить это? Заранее спасибо!

0
задан 1 April 2019 в 07:22
1 ответ

Обычно apt-get dist-upgrade решает эту проблему, заменяя пакеты пакетами из фактических источников apt, которые вы включили, но, похоже, это не так. на этот раз сделали это в вашей системе.

Похоже, вы собираетесь найти способ переустановки исходного пакета Python.

К счастью, вы можете сделать это, указав нужную версию пакета.

Но сначала вы должны выяснить, что это за версия. Для этого используйте политику apt . Вы должны увидеть что-то похожее на это:

error@vmtest-ubuntu1604:~$ sudo apt policy python
python:
  Installed: 3.7.0-1
  Candidate: 2.7.12-1~16.04
  Version table:
 *** 2.7.12-1~16.04 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     2.7.11-1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

Теперь, когда у вас есть номер версии, вы можете установить ее специально:

error@vmtest-ubuntu1604:~$ sudo apt install python=2.7.12-1~16.04 

(Не используйте здесь -f , даже если будет предложено.)

1
ответ дан 4 December 2019 в 15:44

Теги

Похожие вопросы