我设法进入了一种情况,在lsb发布和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
Could not find platform dependent libraries
Consider setting $PYTHONHOME to [:]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
[~] lsb_release
Could not find platform independent libraries
Could not find platform dependent libraries
Consider setting $PYTHONHOME to [:]
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版本,我就无法修复我的python3安装,反之亦然。
发布于 2019-04-15 07:38:26
您可以在不修复lsb_release的情况下修复Python安装。您的Python安装需要重新安装其他Python包;至少
sudo apt install --reinstall libpython3.6-minimal也许还有更多。若要重新安装所有软件包,请运行
sudo apt install --reinstall libpython3.6{,-minimal,-stdlib} python3.6{,-minimal}然后,您会发现lsb_release工作得很好。
https://unix.stackexchange.com/questions/512473
复制相似问题