每次打开终端时,我都会在 shell 屏幕上打印以下消息。
bash: /usr/lib/command-not-found: /usr/bin/python3: bad interpreter: Too many levels of symbolic links
有人可以帮助我了解这里发生了什么以及如何解决这个问题吗?
编辑:
ls -l /usr/bin | grep python3
返回以下内容
lrwxrwxrwx 1 root root 29 Aug 15 20:59 dh_python3 -> ../share/dh-python/dh_python3
lrwxrwxrwx 1 root root 23 Aug 20 16:08 pdb3.5 -> ../lib/python3.5/pdb.py
lrwxrwxrwx 1 root root 23 Oct 9 11:57 pdb3.6 -> ../lib/python3.6/pdb.py
lrwxrwxrwx 1 root root 31 Aug 26 2018 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx 1 root root 18 Oct 24 17:25 python3 -> /usr/bin/python3.5
lrwxrwxrwx 1 root root 16 Oct 24 17:24 python3.5 -> /usr/bin/python3
lrwxrwxrwx 1 root root 33 Aug 20 16:08 python3.5-config -> x86_64-linux-gnu-python3.5-config
-rwxr-xr-x 1 root root 4460272 Aug 20 16:08 python3.5m
lrwxrwxrwx 1 root root 34 Aug 20 16:08 python3.5m-config -> x86_64-linux-gnu-python3.5m-config
-rwxr-xr-x 2 root root 4604496 Oct 9 11:57 python3.6
-rwxr-xr-x 2 root root 4604496 Oct 9 11:57 python3.6m
lrwxrwxrwx 1 root root 10 Aug 26 2018 python3m -> python3.5m
lrwxrwxrwx 1 root root 34 Aug 20 16:08 x86_64-linux-gnu-python3.5-config -> x86_64-linux-gnu-python3.5m-config
-rwxr-xr-x 1 root root 3185 Aug 20 16:05 x86_64-linux-gnu-python3.5m-config
lrwxrwxrwx 1 root root 33 Mar 23 2016 x86_64-linux-gnu-python3-config -> x86_64-linux-gnu-python3.5-config
lrwxrwxrwx 1 root root 34 Mar 23 2016 x86_64-linux-gnu-python3m-config -> x86_64-linux-gnu-python3.5m-config
谢谢,扎曼
答案1
您有带有符号链接的循环:
lrwxrwxrwx 1 root root 18 Oct 24 17:25 python3 -> /usr/bin/python3.5
lrwxrwxrwx 1 root root 16 Oct 24 17:24 python3.5 -> /usr/bin/python3
但我不知道你是如何得到它的,也不知道如何建议来解决它:)
重新安装可能会对您有所帮助。或者,如果您告诉我们您使用的系统以及如何安装 python(您使用的命令和该命令的顺序和/或您使用哪个手册来安装/升级 python),这将有助于了解发生了什么以及如何安装要解决这个问题。
答案2
您可以尝试which python
查看当前所在的 python 路径,然后创建从 /usr/bin/python3 链接到当前 python 路径的链接,如下所示:
sudo ln -s <your-current-python-path> /usr/bin/python3
要查看您可以使用的符号链接ls -l /usr/bin/python3
,它将显示现有链接,您可以使用以下命令删除它rm -i /usr/bin/python3