put this in the first line of your script: #!/usr/bin/env python Make the file executable with chmod +x myfile.py Execute with ./myfile.py