running scripts without using python keyword [duplicate]

This question already has an answer here:

I would like apologise since this is not exactly a programming releated question but rather something I would like to know :

I installed a python library with files say: lib.py, lib2.py .. lib-n.py. All these scripts take command line arguments when being called. So it looks like

username@machinename:~$ lib.py -s <args> -t <args> ..

Now like you can see above, I can run these scripts form any directory and without using the ‘python’ keyword before calling them. I would like to do this with the python scripts that I write as well. ie; I should be able to call them from any directory instead of ‘cd’ing to their location.

P.S: Using a Linux machine running Ubuntu 12.04 and python 2.7.3


Source: unix

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.