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
  • 9,830
  • 10
  • 62
  • 115

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
  • 260,549
  • 28
  • 431
  • 505
1
python -c "import sys; print (sys.path)"
joharr
  • 403
  • 4
  • 12