Reputation: 1
How can I achieve something like $ python --search-for-includes=/foo/bar /home/user/x/script.py
,where script.py
has import something
and something.py
is in /foo/bar
,
without editing an environment variable, and without editing script.py
.
I tried python -c 'import sys; sys.path.append("/foo/bar")' /home/user/x/script.py
, but it did not work.
Upvotes: 0
Views: 72
Reputation: 369054
Use PYTHONPATH
environment variable in following way:
$ PYTHONPATH=/foo/bar:$PYTHONPATH python /home/user/x/script.py
Upvotes: 1