How can I run a python script with my own command line name like 'myscript' without having to do 'python myscript.py' in the terminal?
Add a shebang line to the top of the script:
#!/usr/bin/env python
Mark the script as executable:
chmod +x myscript.py
Add the dir containing it to your PATH variable. (If you want it to stick, you'll have to do this in .bashrc or .bash_profile in your home dir.)
PATH
.bashrc
.bash_profile
export PATH=/path/to/script:$PATH
1.4m articles
1.4m replys
5 comments
57.0k users