Eliminate Python __pycache__ directories
Python ≥ 3.8 can put all Python .pyc cache files under one system-wide directory by the
PYTHONPYCACHEPREFIX
environment variable.
For Windows, set environment variable PYTHONPYCACHEPREFIX
to %temp%
.
For MacOS / Linux in .bashrc, .zshrc or other appropriate shell configuration file add the line export PYTHONPYCACHEPREFIX=$TMPDIR
Python < 3.8 can also avoid writing .pyc files anywhere with the
PYTHONDONTWRITEBYTECODE
environment variable.
For Windows, set environment variable PYTHONDONTWRITEBYTECODE
to 1
.
For MacOS / Linux in .bashrc, .zshrc or other appropriate shell configuration file add the line export PYTHONDONTWRITEBYTECODE=1
.