make python scripts executable
To make a python script executable there are simple three steps:
- add shebang line
- in first line of .py script add this line
#!usr/bin/env python ... python code ...
- in first line of .py script add this line
- allow execute mode
- make script executable along with read and write that are there already
chmod +x <script_file.py>
- make script executable along with read and write that are there already
- make bin directory in home folder and mv script there
cd ~ mkdir bin mv path/to/script_file.py ~/bin/.
That is it. It is applicable only on Linux. Path to python env also might be different depending on how and where you install python. If want to specify python version then n step 1 replace python by python*. Place version numbers at *.