lsb-releaseとpython3の間の循環依存関係(ubuntu 18.04)

lsb-releaseとpython3の間の循環依存関係(ubuntu 18.04)

lsb-releaseとpython3の間に循環依存関係がある状況に陥りました。これを試みると、sudo apt install python3 --reinstall次の結果が表示されます(メイン行のみを貼り付けました)。

(Reading database ... 470097 files and directories currently installed.)
Preparing to unpack .../python3_3.6.7-1~18.04_amd64.deb ...
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'

[~] lsb_release
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 0x00007fa905a81740 (most recent call first):
Aborted (core dumped)

明らかに私のlsb_releaseが破損しています。しかし、私がsudo apt-get install lsb-release走ったら

dpkg: error processing package python3 (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
dpkg: dependency problems prevent configuration of lsb-release:
 lsb-release depends on python3:any (>= 3.4~); however:
  Package python3 is not configured yet.

したがって、lsb-releaseを変更せずにpython3のインストールを変更することはできません。その逆も同様です。

ベストアンサー1

Pythonのインストールを修復せずに修復できますlsb_release。 Pythonをインストールするには、少なくとも他のPythonパッケージを再インストールする必要があります。

sudo apt install --reinstall libpython3.6-minimal

おそらくもっとあるかもしれません。すべてのパッケージを再インストールするには、次の手順を実行します。

sudo apt install --reinstall libpython3.6{,-minimal,-stdlib} python3.6{,-minimal}

lsb_releaseそうすれば、それがうまく機能することがわかります。

おすすめ記事