Skip to content

Instantly share code, notes, and snippets.

@1st
Last active November 12, 2019 23:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1st/ced02a1c64ac7b82bb27e432eea6b068 to your computer and use it in GitHub Desktop.
Save 1st/ced02a1c64ac7b82bb27e432eea6b068 to your computer and use it in GitHub Desktop.
Fix virtualenv after Python upgrade via Homebrew
# Edit file and add there next function:
nano ~/.zshrc
# - OR -
nano ~/.profile
# Paste this function in the file:
function fix_virtualenv {
#
# Usage: fix_virtualenv project_name
#
PROJECT_NAME=$1
# First of all, delete all broken links. Replace my_project_name` to your virtual env name
find ~/.virtualenvs/$PROJECT_NAME/ -type l -delete
# Then create new links to the current Python version
virtualenv ~/.virtualenvs/$PROJECT_NAME/
}
# Then do:
source ~/.zshrc
# - OR -
source ~/.profile
# And finally:
fix_virtualenv project_name
@1st
Copy link
Author

1st commented Oct 2, 2019

Also read nice tricks of how to use Python on macOS: https://github.com/1st/python-on-osx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment