Created
July 14, 2023 09:14
-
-
Save vepetkov/2332bf0228a1863a9c322cf3a9d9e1e5 to your computer and use it in GitHub Desktop.
Load .venv automatically using DirEnv
This file contains hidden or 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
# Store in ~/.config/direnv/direnvrc to run for all folders automatically | |
# check if VENV is loaded | |
if [[ -z "${VIRTUAL_ENV_PROMPT}" ]] ; then | |
if [ ! -d ".venv" ] ; then | |
echo "Installing virtualenv for $(python -V)" | |
python -m venv .venv | |
fi | |
echo "Activating $(python -V) virtualenv from .venv" | |
source .venv/bin/activate | |
fi | |
echo "Virtualenv has been activated for $(python -V)" | |
echo "$(which python)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment