Make python script executable in Raspberry Pi
In unix-like operating systems , python scripts can be made executable using the following process:
1.Add following line as the first line in the script:
2.At the command prompt, type the following to make myfile.py executable:
$ sudo chmod +x myfile.py
3.Move myfile.py into your bin directory, and it will be runnable from anywhere.
$ cp myfile.py /usr/bin OR $ cp myfile.py /usr/local/bin