Skip to content

Instantly share code, notes, and snippets.

@mmaybeno
Forked from tevino/fix_virtualenv
Created July 20, 2016 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmaybeno/842e393a08eb9201fc5f257c47a7c342 to your computer and use it in GitHub Desktop.
Save mmaybeno/842e393a08eb9201fc5f257c47a7c342 to your computer and use it in GitHub Desktop.
Fix python virtualenv after python update
#!/usr/bin/env bash
ENV_PATH="$(dirname "$(dirname "$(which pip)")")"
SYSTEM_VIRTUALENV="$(which -a virtualenv|tail -1)"
echo "Ensure the root of current virtualenv:"
echo " $ENV_PATH"
read -p "‼️ Say no if you are not sure (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "♻️ Removing old symbolic links......"
find "$ENV_PATH" -type l -delete -print
echo "💫 Creating new symbolic links......"
$SYSTEM_VIRTUALENV "$ENV_PATH"
echo "🎉 Done!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment