lsb_release 错误:bash:/usr/bin/lsb_release:/usr/bin/python3:错误的解释器:没有此文件或目录

lsb_release 错误:bash:/usr/bin/lsb_release:/usr/bin/python3:错误的解释器:没有此文件或目录

从 Ubuntu MATE 21.10 Impish 升级到 Ubuntu MATE 22.04 Jammy 后,当我运行时lsb_release出现此错误:

$ lsb_release

bash: /usr/bin/lsb_release: /usr/bin/python3: bad interpreter: No such file or directory

相关命令:

$ whereis lsb_release
lsb_release: /usr/bin/lsb_release /usr/share/man/man1/lsb_release.1.gz

$ python -V
bash: python: command not found
$ python3 -V
bash: python3: command not found

$ python3.10 -V
Python 3.10.4

$ which python3 or $ which python
Nothing.

$ which python3.10
/usr/bin/python3.10

$ whereis python
python: /usr/bin/python /usr/share/python /usr/share/man/man1/python.1.gz

$ whereis python3
python3: /usr/lib/python3 /etc/python3 /usr/share/python3 /usr/share/man/man1/python3.1.gz

$ whereis python3.10
python3.10: /usr/bin/python3.10 /usr/lib/python3.10 /etc/python3.10 /usr/local/lib/python3.10 /usr/include/python3.10 /usr/share/man/man1/python3.10.1.gz
ls -lsh /usr/bin/python*
   0 lrwxrwxrwx 1 root root    7 Oct 11  2021 /usr/bin/python -> python3
   0 lrwxrwxrwx 1 root root    9 Jul 28  2021 /usr/bin/python2 -> python2.7
3.5M -rwxr-xr-x 1 root root 3.5M Mar 12 11:54 /usr/bin/python2.7
5.7M -rwxr-xr-x 1 root root 5.7M Apr  2 14:34 /usr/bin/python3.10
   0 lrwxrwxrwx 1 root root   34 Apr  2 14:34 /usr/bin/python3.10-config -> x86_64-linux-gnu-python3.10-config
   0 lrwxrwxrwx 1 root root   17 Mar 25 18:11 /usr/bin/python3-config -> python3.10-config
4.0K -rwxr-xr-x 1 root root 1.8K Aug  6  2019 /usr/bin/python3-unidiff
$ sudo ln -s /usr/bin/python3 /usr/bin/python3.10
ln: failed to create symbolic link '/usr/bin/python3.10': File exists
$ sudo update-alternatives --config python3
update-alternatives: error: no alternatives for python3

$ sudo update-alternatives --config python
update-alternatives: error: no alternatives for python

我发现lsb_release错误的方式是因为mate-menu(高级 MATE 菜单)停止工作(从任务栏中消失),当我尝试重新安装它(使用 Synaptic)时,出现此错误:

E: mate-menu: package is in a very bad inconsistent state; you should  reinstall it before attempting configuration

Can't exec "lsb_release": No such file or directory at /usr/share/perl5/Debconf/FrontEnd/Gnome.pm line 184, <> line 1.
Use of uninitialized value in lc at /usr/share/perl5/Debconf/FrontEnd/Gnome.pm line 184, <> line 1.
(Reading database ... 378043 files and directories currently installed.)

Preparing to unpack .../lsb-release_11.1.0ubuntu4_all.deb ...
Unpacking lsb-release (11.1.0ubuntu4) over (11.1.0ubuntu4) ...
dpkg: error processing package mate-menu (--configure):

 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration

Setting up lsb-release (11.1.0ubuntu4) ...
Processing triggers for man-db (2.10.2-1) ...
Errors were encountered while processing:
 mate-menu

虽然我找到了这些类似的线程,但它们对我来说不起作用。谢谢。

https://askubuntu.com/a/919416/928088

https://stackoverflow.com/q/62329393/11855487

答案1

正如@steeldriver 评论中所建议的,我切换了ln -s命令中的参数。 撤销它解决了该问题:

sudo ln -s /usr/bin/python3.10 /usr/bin/python3

相关内容