Pyenv + Virtualenv #
Requirements:
Installation via Homebrew:
brew install pyenv pyenv-virtualenv
List available versions:
pyenv install --list
Install a specific Python version:
pyenv install 2.7.16
Create a new virtualenv:
pyenv virtualenv 2.7.16 my_project_name
Uninstall a virtualenv:
pyenv uninstall my_project_name
To activate an environment manually:
pyenv activate my_project_name
To automatically switch virtualenv when switching to a project’s directory, go
to the project’s directory and create .python-version
:
echo "my_project_name" > .python-version