I am not sure if I searched for the wrong terms, but I could not find much on this subject. I am on osx and I’d like to compile a commandline python script into a small commandline app, that I can put into usr/local/bin so I can call it from anywhere. Is there a straighforward way to do that?
Thanks
The simplest way to do this is to rename your file from
filename.pytofilenameand add this line to the top of the file.#!/usr/bin/env pythonYou may also need to set the executable bit on the file, which may be set using
chmod +xon the command line.