Skip to main content
6 of 9
add code from title to question body for people to copy-paste easier to their own Python files :)
Gabriel Staples
  • 56.2k
  • 35
  • 299
  • 394

Why do people write #!/usr/bin/env python on the first line of a Python script?

I see this at the top of Python files:

  1. For Python 2 files
    #!/usr/bin/env python 
  2. For Python 3 files
    #!/usr/bin/env python3 

It seems to me like the files run the same without that line.

john garcias
  • 14k
  • 3
  • 18
  • 3