Last active
November 12, 2019 23:08
-
-
Save 1st/ced02a1c64ac7b82bb27e432eea6b068 to your computer and use it in GitHub Desktop.
Fix virtualenv after Python upgrade via Homebrew
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
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also read nice tricks of how to use Python on macOS: https://github.com/1st/python-on-osx