0

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.

zell
  • 8,807
  • 8
  • 50
  • 99

2 Answers2

1

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.

user2357112
  • 235,058
  • 25
  • 372
  • 444
0
python -c "import sys; print (sys.path)"
joharr
  • 284
  • 3
  • 10