Skip to content

Instantly share code, notes, and snippets.

@tarunbhardwaj
Last active June 16, 2018 03:54
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 tarunbhardwaj/4e84c86345035c48da7eae8993e42cc1 to your computer and use it in GitHub Desktop.
Save tarunbhardwaj/4e84c86345035c48da7eae8993e42cc1 to your computer and use it in GitHub Desktop.
Fix broken python links in venv
# Fix borken python links in all venv
cd ~/.virtualenvs
for i in `workon`
do
if [ $(find $i/ -type l | tail -n 1 | grep "python3") ]; then
echo "$i python3"
find $i/ -type l -delete
virtualenv $i --python=python3
else
echo "$i python2"
find $i/ -type l -delete
virtualenv $i --python=python2
fi
done
# Uninstall all venv local pip
for i in `workon`
do
workon $i
if [ $(which pip | grep '.virtual') ]; then
pip uninstall pip -y
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment