4

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

lilouch
  • 934
  • 3
  • 18
  • 38
  • 1
    Related: http://stackoverflow.com/questions/2429511/why-do-people-write-usr-bin-env-python-on-the-first-line-of-a-python-script Do not link `env` to actual `python` version, this program has special purpose (see related Q) – myaut Jun 12 '15 at 05:54
  • 1
    Yes It was a mistake. I saw this post but how I can fix it ? – lilouch Jun 12 '15 at 05:57
  • Messing with `/usr/bin` is an absolute no-no on basically every modern platform. – tripleee Sep 08 '19 at 11:33

1 Answers1

5

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.

Anonymous
  • 382
  • 2
  • 7
lilouch
  • 934
  • 3
  • 18
  • 38