1

Everytime I open up a terminal, I get the below message printed on the shell screen.

bash: /usr/lib/command-not-found: /usr/bin/python3: bad interpreter: Too many levels of symbolic links

Could someone help me understand what is happening here and how I could fix this issue?

EDIT:

ls -l /usr/bin | grep python3

returned the below

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

Thanks, Zaman

5

2 Answers 2

1

You have cycle with symlinks:

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

But I have no idea how you get it and don't know what to suggest to resolve it :)

May be reinstall will help you. Or may be if you tell us what system you use and how you install python (commands and sequence of this command you use and/or which manual you use to install/upgrade python), it will help to understand what is going on and how to fix it.

1
  • 1
    Suggesting a reinstall (of what?) seems like overkill for sorting out a symbolic link loop.
    – Kusalananda
    Commented Nov 3, 2019 at 17:29
-2

You can try which python to see the path of python that you are currently on and then create a link from /usr/bin/python3 link to your current python path as:

sudo ln -s <your-current-python-path> /usr/bin/python3

to see the sym links you can use ls -l /usr/bin/python3 that will show existing links and you can remove that using rm -i /usr/bin/python3

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .