Skip to content
Advertisement

To print python’s sys.path from the command line

I want to print python’s sys.path from the command line, but this one is not working:

python -m sys  -c "print (sys.path)"

although print -c "import sys; print (sys.path)" would work. It seems that “-m” in the first one above does not load the module “sys”. Any clarification on how to correctly import a module from python flags? Thanks.

Advertisement

Answer

There is no such flag. -m does something completely different from what you want. You can go through the Python command line docs to see the lack of such a flag if you want.

Just put the import in the command.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement