Установка debian apt не работает после удаления python [дубликат]

Извините, моя ОС на французском языке, поэтому я надеюсь, что это не будет проблемой для вас, ребята.

У меня были проблемы с установкой python и awx, поэтому я решил удалить все пакеты python, но наделал большую глупость. Теперь я даже не могу установить такой пакет, как vim. Я следил за сообщение для очистки Python, поэтому я сделал все шаги ниже.

2666 24/04/19 10:27:03 rm -rf ~/.local/lib/python*
2733 24/04/19 10:45:34 rm -rf python*
2734 24/04/19 10:45:38 sudorm -rf python*
2736 24/04/19 10:46:02 sudo rm -rf python2.7 python3 python3.5
2748 24/04/19 10:46:47 rm -rf python2.7 libpython2.7.a python3.5
2749 24/04/19 10:46:50 sudo rm -rf python2.7 libpython2.7.a python3.5
2754 24/04/19 10:47:02 sudo rm -rf pkgconfig/

Я пробовал команду ниже

user@user:/usr/bin$ sudo apt-get install python3-minimal
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
python3-minimal est déjà la version la plus récente (3.5.1-3).
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
5 partiellement installés ou enlevés.
Après cette opération, 0 o d'espace disque supplémentaires seront utilisés.
Souhaitez-vous continuer*? [O/n] o
Paramétrage de python3 (3.5.1-3) ...
running python rtupdate hooks for python3.5...
/usr/share/python3/runtime.d/dh-python.rtupdate: 5: /usr/share/python3/runtime.d/dh-python.rtupdate: py3clean: not found
error running python rtupdate hook dh-python
dpkg: erreur de traitement du paquet python3 (--configure)*:
 le sous-processus script post-installation installé a retourné une erreur de sortie d'état 4
Paramétrage de python3.5-minimal (3.5.2-2ubuntu0~16.04.5) ...
/var/lib/dpkg/info/python3.5-minimal.postinst: 46: /var/lib/dpkg/info/python3.5-minimal.postinst: /usr/bin/python3.5: not found
dpkg: erreur de traitement du paquet python3.5-minimal (--configure)*:
 le sous-processus script post-installation installé a retourné une erreur de sortie d'état 127
Paramétrage de python2.7-minimal (2.7.12-1ubuntu0~16.04.4) ...
/var/lib/dpkg/info/python2.7-minimal.postinst: 42: /var/lib/dpkg/info/python2.7-minimal.postinst: /usr/bin/python2.7: not found
dpkg: erreur de traitement du paquet python2.7-minimal (--configure)*:
 le sous-processus script post-installation installé a retourné une erreur de sortie d'état 127
dpkg: des problèmes de dépendances empêchent la configuration de python-minimal*:
 python-minimal dépend de python2.7-minimal (>= 2.7.12-1~)*; cependant*:
 Le paquet python2.7-minimal n'est pas encore configuré.

dpkg: erreur de traitement du paquet python-minimal (--configure)*:
 problèmes de dépendances - laissé non configuré
dpkg: des problèmes de dépendances empêchent la configuration de python2.7*:
 python2.7 dépend de python2.7-minimal (= 2.7.12-1ubuntu0~16.04.4)*; cependant*:
 Le paquet python2.7-minimal n'est pas encore configuré.

dpkg: erreur de traitement du paquet python2.7 (--configure)*:
 problèmes de dépendances - laissé non configuré
Des erreurs ont été rencontrées pendant l'exécution*:
 python3
 python3.5-minimal
 python2.7-minimal
 python-minimal
 python2.7
E: Sub-process /usr/bin/dpkg returned an error code (1)

Я тоже пробовал эту команду

        sudo dpkg --force-all --configure -a
Paramétrage de python3 (3.5.1-3) ...
running python rtupdate hooks for python3.5...
/usr/share/python3/runtime.d/dh-python.rtupdate: 5: /usr/share/python3/runtime.d/dh-python.rtupdate: py3clean: not found
error running python rtupdate hook dh-python
dpkg: erreur de traitement du paquet python3 (--configure) :
 le sous-processus script post-installation installé a retourné une erreur de sortie d'état 4
Paramétrage de python3.5-minimal (3.5.2-2ubuntu0~16.04.5) ...
/var/lib/dpkg/info/python3.5-minimal.postinst: 46: /var/lib/dpkg/info/python3.5-minimal.postinst: /usr/bin/python3.5: not found
dpkg: erreur de traitement du paquet python3.5-minimal (--configure) :
 le sous-processus script post-installation installé a retourné une erreur de sortie d'état 127
Paramétrage de python2.7-minimal (2.7.12-1ubuntu0~16.04.4) ...
/var/lib/dpkg/info/python2.7-minimal.postinst: 42: /var/lib/dpkg/info/python2.7-minimal.postinst: /usr/bin/python2.7: not found
dpkg: erreur de traitement du paquet python2.7-minimal (--configure) :
 le sous-processus script post-installation installé a retourné une erreur de sortie d'état 127
dpkg: python2.7 : problèmes de dépendances, mais configuration comme demandé :
 python2.7 dépend de python2.7-minimal (= 2.7.12-1ubuntu0~16.04.4) ; cependant :
 Le paquet python2.7-minimal n'est pas encore configuré.

Paramétrage de python2.7 (2.7.12-1ubuntu0~16.04.4) ...
/var/lib/dpkg/info/python2.7.postinst: 9: /var/lib/dpkg/info/python2.7.postinst: /usr/bin/python2.7: not found
dpkg: erreur de traitement du paquet python2.7 (--configure) :
 le sous-processus script post-installation installé a retourné une erreur de sortie d'état 127
dpkg: python-minimal : problèmes de dépendances, mais configuration comme demandé :
 python-minimal dépend de python2.7-minimal (>= 2.7.12-1~) ; cependant :
 Le paquet python2.7-minimal n'est pas encore configuré.

Paramétrage de python-minimal (2.7.12-1~16.04) ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: erreur de traitement du paquet python-minimal (--configure) :
 le sous-processus script post-installation installé a retourné une erreur de sortie d'état 1
Des erreurs ont été rencontrées pendant l'exécution :
 python3
 python3.5-minimal
 python2.7-minimal
 python2.7
 python-minimal

Тест установки Vim

sudo apt install vim
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
vim est déjà la version la plus récente (2:7.4.1689-3ubuntu1.2).
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
5 partiellement installés ou enlevés.
Après cette opération, 0 o d'espace disque supplémentaires seront utilisés.
Souhaitez-vous continuer*? [O/n] o
Paramétrage de python3 (3.5.1-3) ...
running python rtupdate hooks for python3.5...
/usr/share/python3/runtime.d/dh-python.rtupdate: 5: /usr/share/python3/runtime.d/dh-python.rtupdate: py3clean: not found
error running python rtupdate hook dh-python
dpkg: erreur de traitement du paquet python3 (--configure)*:
le sous-processus script post-installation installé a retourné une erreur de sortie d'état 4
Paramétrage de python3.5-minimal (3.5.2-2ubuntu0~16.04.5) ...
/var/lib/dpkg/info/python3.5-minimal.postinst: 46: /var/lib/dpkg/info/python3.5-minimal.postinst: /usr/bin/python3.5: not found
dpkg: erreur de traitement du paquet python3.5-minimal (--configure)*:
le sous-processus script post-installation installé a retourné une erreur de sortie d'état 127
Paramétrage de python2.7-minimal (2.7.12-1ubuntu0~16.04.4) ...
/var/lib/dpkg/info/python2.7-minimal.postinst: 42: /var/lib/dpkg/info/python2.7-minimal.postinst: /usr/bin/python2.7: not found
dpkg: erreur de traitement du paquet python2.7-minimal (--configure)*:
le sous-processus script post-installation installé a retourné une erreur de sortie d'état 127
dpkg: des problèmes de dépendances empêchent la configuration de python-minimal*:
python-minimal dépend de python2.7-minimal (>= 2.7.12-1~)*; cependant*:
Le paquet python2.7-minimal n'est pas encore configuré.

dpkg: erreur de traitement du paquet python-minimal (--configure)*:
problèmes de dépendances - laissé non configuré
dpkg: des problèmes de dépendances empêchent la configuration de python2.7*:
python2.7 dépend de python2.7-minimal (= 2.7.12-1ubuntu0~16.04.4)*; cependant*:
Le paquet python2.7-minimal n'est pas encore configuré.

dpkg: erreur de traitement du paquet python2.7 (--configure)*:
problèmes de dépendances - laissé non configuré
Des erreurs ont été rencontrées pendant l'exécution*:
python3
python3.5-minimal
python2.7-minimal
python-minimal
python2.7
E: Sub-process /usr/bin/dpkg returned an error code (1)

Спасибо за помощь

РЕДАКТИРОВАТЬ: Я пытался установить пакет вручную, и у меня есть новый проблема сообщена

  sudo dpkg -i --force-overwrite python3.5-minimal_3.5.2-2ubuntu0~16.04.5_amd64.deb
(Reading database ... 165302 files and directories currently installed.)
Preparing to unpack python3.5-minimal_3.5.2-2ubuntu0~16.04.5_amd64.deb ...
Unpacking python3.5-minimal (3.5.2-2ubuntu0~16.04.5) over (3.5.2-2ubuntu0~16.04.5) ...
Setting up python3.5-minimal (3.5.2-2ubuntu0~16.04.5) ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Current thread 0x00007f1cf2fef700 (most recent call first):
Aborted
dpkg: error processing package python3.5-minimal (--install):
 subprocess installed post-installation script returned error exit status 134
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 python3.5-minimal
0
задан 25 April 2019 в 11:33

1 ответ

У Вас есть 2 проблемы теперь

  • Ubuntu является в большой степени иждивенцем на Python, и Вы почти полностью удалили Python из своей системы.
  • Вы вручную удалили Python с помощью rm команда вместо того, чтобы удалить его с apt (или dpkg)

Так как Вы не прошли процесс удаления правильно, кажется, что Ваш диспетчер пакетов теперь думает, что Вам установили Python, но не настроенные (который не имеет место). И Вы, кажется, получаете некоторые проблемы зависимости с некоторыми пакетами Python, и необходимо переустановить их:

  • python3
  • python3.5-минимальный
  • python2.7-минимальный
  • минимальный Python
  • python2.7

Я не могу судить меня для сообщения, какая опция решит проблему, но я дам Вам 3 решения. Запуск с самого легкого. Я рекомендую брать резервное копирование для любых необходимых файлов, поскольку у Вас в настоящее время есть поврежденная система, и следующее решение не может закончить тем, что фиксировало его.

  1. Попытайтесь позволить apt зафиксируйте свои зависимости отдельно со следующей командой:

    sudo apt install -f
    
  2. Установка силы пакеты с Кв. (касательно):

    sudo apt -o Dpkg::Options::="--force-overwrite" install python3 python3.5-minimal python2.7-minimal python-minimal python2.7
    
  3. Установите их вручную с dpkg.
    От вывода выше, я предполагаю, что Вы используете 16.04. В противном случае просто измените версию прежде, чем загрузить пакеты.

    Загрузите каждый поврежденный пакет с https://packages.ubuntu.com и вызовите, устанавливают его вручную с dpkg.

    sudo dpkg -i --force-overwrite /path/to/downloaded/package
    

Примечания:

  • P.S. После установки их возможно, что можно получить другие ошибки с другими пакетами Python. Просто перезапустите упомянутый процесс, но для тех новых пакетов.
  • P.S.S --force-overwrite флаг, скорее всего, необходим для принуждения dpkg устанавливать пакеты, даже если это думает, что они уже установлены.
2
ответ дан 25 April 2019 в 11:33

Другие вопросы по тегам:

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