0

I am trying to run in terminal hello.py python script:

#! usr/bin/env python3  
print("Hello", "World!")

On invoking the following in terminal (while being in working directory where hello.py is located):

$ chmod +x hello.py
$ ./hello.py

I am getting:

bash: ./hello.py: usr/bin/env: bad interpreter: No such file or directory

I am not able to go beyond it. I've checked the following in terminal (maybe needed in further clarification):

_____________________________________________________________________
$ python3
Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.executable)
/usr/bin/python3
_____________________________________________________________________
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
_____________________________________________________________________
$ which python3
/usr/bin/python3
_____________________________________________________________________

Thanks for any clarification!

1
  • Debian advise to use absolute path of interpreter like /usr/bin/python3 Commented Feb 11, 2016 at 15:39

1 Answer 1

3

It's quite simple, you forgot to give the absolute path.

Use #!/usr/bin/env python3

Sign up to request clarification or add additional context in comments.

1 Comment

This isn't entirely clear. I think you should say, "you forgot to include the first slash." At a glance, it looks like the same thing he tried.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.