Created
May 21, 2019 02:16
-
-
Save sinewalker/6733343f98c6895e55f3280f34051d33 to your computer and use it in GitHub Desktop.
Freeze your python pip requirements to a known place, to guard against Homebrew mess-ups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
freezenv() { | |
FUNCDESC='Freeze the active Python Environment pip requirements. | |
This stores the requirements.txt in the active $VIRTUAL_ENV or $CONDA_PREFIX | |
directory, overwriting any existing requirements file.' | |
if [[ -z ${VIRTUAL_ENV-$CONDA_PREFIX} ]] ; then | |
error "$FUNCNAME: no active python or conda venv" | |
return 1 | |
fi | |
local VENV_REQS=${VIRTUAL_ENV-$CONDA_PREFIX}/requirements.txt | |
echo "Storing PIP package list into ${VENV_REQS}" | |
pip freeze > ${VENV_REQS} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not really necessary for Anaconda, since Homebrew won't mess with that. But I include the functionality for conda too, in case it's needed for other reasons.