4
votes

I did a mistake. I installed Python 3 and then I did the following command in order to have the defaut version Python as Python3

sudo ln -fs /opt/Python-3.4.1/python /usr/bin/python

But I wanted to come back to the python2.7 and I did

sudo ln -fs /usr/bin/python2.7/python /usr/bin/python

Now, When I want to run a bash script with python inside, I have this following error:

/usr/bin/env: bad interpreter: Not a directory

When I run this command:

ls -l /usr/bin/env

I have this result in red:

lrwxrwxrwx 1 root root 25 Jun 12 13:37 /usr/bin/env -> /usr/bin/python2.7/python

Indeed, when I go in this directory, I don't have the env executable anymore but a broken link.

I didn't find a solution on the internet.

Could you help me ? I begin to feel bad about my mistake.

Thanks

1
Related: stackoverflow.com/questions/2429511/… Do not link env to actual python version, this program has special purpose (see related Q)myaut
Yes It was a mistake. I saw this post but how I can fix it ?lilouch
Messing with /usr/bin is an absolute no-no on basically every modern platform.tripleee

1 Answers

5
votes

Okey, I solved my issue by reinstalling this env file.

sudo apt-get install --reinstall coreutils

Then thanks to this post in Why do people write the #!/usr/bin/env python shebang on the first line of a Python script? I know better how to switch between version and do not do the same mistake anymore.