после того, как я обновился до Ubuntu bionic на моем домашнем сервере без головы, я попытался удалить Python2.7 и установить Python3, но что-то пошло не так. Думаю, я вручную удалил некоторые файлы, которые не следует.
После удаления Python2, когда я пошел apt install python3
У меня есть ошибки:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
python3-minimal python3.6 python3.6-minimal
Suggested packages:
python3-doc python3-tk python3-venv python3.6-venv python3.6-doc binfmt-support
The following NEW packages will be installed:
python3 python3-minimal python3.6 python3.6-minimal
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,616 kB of archives.
After this operation, 7,272 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package python3.6-minimal.
(Reading database ... 86246 files and directories currently installed.)
Preparing to unpack .../python3.6-minimal_3.6.9-1~18.04ubuntu1.1_armhf.deb ...
Unpacking python3.6-minimal (3.6.9-1~18.04ubuntu1.1) ...
Setting up python3.6-minimal (3.6.9-1~18.04ubuntu1.1) ...
# Empty sitecustomize.py to avoid a dangling symlink
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Current thread 0xb6fb9350 (most recent call first):
Aborted
dpkg: error processing package python3.6-minimal (--configure):
installed python3.6-minimal package post-installation script subprocess returned error exit status 134
Errors were encountered while processing:
python3.6-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)
Погуглил на предмет ошибок Я кое-что нашел и попытался сбросить языковой стандарт (locale-gen en_US.UTF-8
), сбросив $ PYTHONHOME (export PYTHONHOME=/usr/local/lib/python3.6
), автофиксация (apt install -f
). Не сработало.