The shebang line informs the operating system’s shell where to find the interpreter. The program loader will execute the specified interpreter with the same arguments that were initially passed.
Add a shebang (#!
) to a Python script
How to add a shebang (#!
) to a Python 3 file:
|
|
In addition to the normal execution by calling the interpreter directly:
|
|
the file can be called like this:
|
|
Note: The executable may not have executable permissions by the user. To enable for this, simply run:
|
|