Search code examples
pythondos

Calling modules installed in python's site-packages from dos


How does one call a python module that has been installed, into the folder site-packages, from the DOS/CMD prompt

I'm hoping for a nice solution like

python module.py arg1 arg2

at present I have

python D:\Folder\Folder\module.py Arg1 Arg2

which is fine for now but I will be installing these modules on other machines where I know the python path but not necessarily the package path. I wanted to know the neatest way to do this sort of thing.


Solution

  • See the documentation on the Python command line utility:

    -m <module-name>
         Search sys.path for the named module and execute its contents as the __main__ module.
    

    rest is here: http://docs.python.org/using/cmdline.html#cmdoption-m