Using the shebang in Python – #!/usr/bin/env python

Use the following as the first line of your python script

#!/usr/bin/env python

to avoid typing python to execute the script.

Say, you have a script called helloWorld.py.  The way to execute it from the shell is $python helloWorld.py but if you shebang line, you would execute $./helloWorld.py

Screen Shot 2015-06-28 at 9.01.57 PM

Using the shebang in Python – #!/usr/bin/env python

Leave a Reply

Your email address will not be published. Required fields are marked *