turning python scripts into executables

You'll have python scripts like do_thing.py, and everytime you have to run it, its painful because you have to type python do_thing.py. To make this less painful do the following:

Rename the file to just do_thing and then at the top of the file tell the program to use the python interpreter with: #!/usr/bin/env python3, after that you can make it executable with chmod +x do_thing, now you can just run ./do_thing


edit this page