Skip to main content Not Intelligent

Pyenv

Reference

https://github.com/pyenv/pyenv

Install

zsh code snippet start

brew install pyenv pyenv-virtualenv

zsh code snippet end

Install latest version

(latest version of python 3)

zsh code snippet start

pyenv install $(pyenv latest -k 3)

zsh code snippet end

Add env to .zshrc

zsh code snippet start

echo 'export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc

zsh code snippet end

Create new virtualenv using latest version

(installed using pyenv install from above)

zsh code snippet start

pyenv virtualenv $(pyenv latest -k 3) an-arbitrary-name

zsh code snippet end

List all virtualenvs

(active virtualenv will have a * prefix)

zsh code snippet start

pyenv virtualenvs

zsh code snippet end