Provide temporary PYTHONPATH on the commandline?
<p>I'm thinking of something like</p>

<p><code>python3 my_script.py --pythonpath /path/to/some/necessary/modules</code></p>

<p>Is there something like this? I know (I think) that Pycharm temporarily modifies <code>PYTHONPATH</code> when you use it to execute scripts; how does Pycharm do it?</p>

<h2>Reasons I want to do this (you don't really need to read the following)</h2>

<p>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 <code>PYTHONPATH</code>s that Pycharm automatically temporarily adds. I don't want to <code>export PYTHONPATH=[...]</code> because it's a big hassle to change it often (and suppose it really does need to change often).</p>