It seems to me like the files run the same without that line.
If you're running your script in a virtual environment, say venv
, then executing which python
while working on venv
will display the path to the Python interpreter:
~/Envs/venv/bin/python
Note that the name of the virtual environment is embedded in the path to the Python interpreter. Therefore, hardcoding this path in your script will cause two problems:
Therefore, to add to Jonathan's answer, the ideal shebang is #!/usr/bin/env python
, not just for portability across OSes but for portability across virtual environments as well!