Proper shebang for Python script

#!/usr/bin/env python

is more portable because in general the program /usr/bin/env can be used to “activate” the desired command without full path.

Otherwise, you would have to specify the full path of the Python interpreter, which can vary.

So no matter if the Python interpreter was in /usr/bin/python or in /usr/local/bin/python or in your home directory, using #!/usr/bin/env python will work.

Leave a Comment