zell
zell

Reputation: 10204

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.

Upvotes: 0

Views: 3832

Answers (2)

joharr
joharr

Reputation: 535

python -c "import sys; print (sys.path)"

Upvotes: 1

user2357112
user2357112

Reputation: 281262

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.

Upvotes: 1

Related Questions