When I want to run my python applications from commandline (under ubuntu) I have to be in the directory where is the source code app.py and run the application with command
<
A solution some what different from the ones mentioned here: Use an alias.
alias app='python /path/to/app.py'
Add the above line to your ~/.bashrc
or ~/.bash_login
file (or preferably to ~/.bash_aliases
if you are on Ubuntu). Then you can simply use your script as a command line tool with app
.
No need to add a shebang (thereby modifying your existing Python script), no need to make the script executable and no need to change your PATH
.