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效果很好。

相关内容