Provide temporary PYTHONPATH on the commandline?
pycharm, python, pythonpath
Solution
You can specify the python path in an environment variable like so:
PYTHONPATH=/path/to/some/necessary/modules python3 my_script.py
Problem
I'm thinking of something like `python3 my_script.py --pythonpath /path/to/some/necessary/modules` Is there something like this? I know (I think) that Pycharm temporarily modifies `PYTHONPATH` when you use it to execute scripts; how does Pycharm do it? Reasons I want to do this (you don't really need to read the following) The reason I want to do this is that I have some code that usually needs to run on my own machine (which is fine because I use Pycharm to run it) but sometimes needs to run on a remote server (on the commandline), and it doesn't work because the remote server doesn't have the `PYTHONPATH`s that Pycharm automatically temporarily adds. I don't want to `export PYTHONPATH=[...]` because it's a big hassle to change it often (and suppose it really does need to change often).