0

I would like to run my python script as an executable from the command line, usually when I do a bash script I added this to the top of the file:

#!/bin/bash

Then I made the script executable with:

chmod u+x myScript.sh

Is there a way to do this in python scripting? I tried something similar like:

#!/bin/python

However, this did not work.

Sam
  • 21
  • 7
G. LC
  • 794
  • 1
  • 8
  • 27

1 Answers1

2

Add this to the top of your script

#!/usr/bin/env python

or

#!/usr/bin/env python3

depending if you want python2 or python 3

DYZ
  • 55,249
  • 10
  • 64
  • 93