Python command line - add PYTHONPATH during module run

Posted by orokusaki on Stack Overflow See other posts from Stack Overflow or by orokusaki
Published on 2011-01-02T19:33:20Z Indexed on 2011/01/02 19:54 UTC
Read the original article Hit count: 145

Filed under:
|

I want to run:

python somescript.py somecommand

But, when I run this I need PYTHONPATH to include a certain directory. I can't just add it to my environment variables because the directory I want to add changes based on what project I'm running. Is there a way to alter PYTHONPATH while running a script? Note: I don't even have a PYTHONPATH variable, so I don't need to worry about appending to it vs overriding it during running of this script.

© Stack Overflow or respective owner

Related posts about python

Related posts about pythonpath