Python 2 and 3 both generate bytecode in the same directory as, or __pycache__
subdirectory of scripts that you run. One reason it sucks is because it dirties source trees that I would like to keep clean for various reasons that I don't need to explain for this question (please answer this question - not questions that you imagine I have!)
I know you can disable cache generation, but that is inefficient.
Is there a way to run Python (2 or 3) but tell it to store its cache in a completely separate cache directory? Either using an environment variable or a command line flag.
This is not a duplicate of this question or this question.