Сломанные зависимости python в Ubuntu 16.04 (AWS EC2) - PullRequest
0 голосов
/ 25 марта 2019

Я попытался удалить весь установленный Python на моем Ubuntu 16.04. Теперь он понимает, что не должен был этого делать.Тем не менее, просто попытка переустановить Python не работает.

Когда я пытаюсь

$ sudo apt install -f --reinstall python3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  python3-doc python3-tk python3-venv
The following NEW packages will be installed:
  python3
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
Need to get 0 B/8,710 B of archives.
After this operation, 68.6 kB of additional disk space will be used.
Setting up python3.5-minimal (3.5.2-2ubuntu0~16.04.5) ...
# Empty sitecustomize.py to avoid a dangling symlink
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 0x00007fc6b52dd700 (most recent call first):
Aborted
dpkg: error processing package python3.5-minimal (--configure):
 subprocess installed post-installation script returned error exit status 134
dpkg: dependency problems prevent configuration of python3-minimal:
 python3-minimal depends on python3.5-minimal (>= 3.5.1-2~); however:
  Package python3.5-minimal is not configured yet.

dpkg: error processing package python3-minimal (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3.5-minimal
 python3-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ python3
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 0x00007f87215c4700 (most recent call first):
Aborted

Я пытался установить некоторые зависимости, я заметил, что пропали безрезультатно

$ sudo apt-get -f install python3.5-minimal
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3.5-minimal is already the newest version (3.5.2-2ubuntu0~16.04.5).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 dh-python : Depends: python3:any (>= 3.3.2-2~)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Пробовал разные вещи, но на данный моментЯ заблудился, как решить эту проблему

$ sudo apt-get -f install dh-python
Reading package lists... Done
Building dependency tree       
Reading state information... Done
dh-python is already the newest version (2.20151103ubuntu1.1).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 dh-python : Depends: python3:any (>= 3.3.2-2~)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Ответы [ 2 ]

0 голосов
/ 25 марта 2019

Вы должны попробовать: sudo apt-get update

Затем попробуйте удалить python с помощью следующей команды

sudo apt purge python3.x-minimal

, если он успешно удален,

sudo apt-get install python3.6

0 голосов
/ 25 марта 2019

Может быть, лучше установить python из пакета deb с sudo dpkg -i?Вы можете скачать его отсюда , например

...