Should I put #! shebang in Python scripts, and what form should it take?
should I put the shebang in my Python scripts? In what form?
#!/usr/bin/env python
or
#!/usr/local/bin/python
Are these equally portable? Which form is used most?
To define the ability of the script python3 shebang line is used and to be executed like a standalone executable without typing python beforehand in the terminal or when double clicking it in a file manager (when configured properly). It isn't necessary but generally put there so when someone sees the file opened in an editor, they immediately know what they're looking at. However, which shebang line you use IS important.
The Correct usage for Python 3 scripts is as follows:-
#!/usr/bin/env python3