Skip to content

How to use Pyenv

Posted on:June 5, 2023 at 07:57 PM

Table of contents

Open Table of contents



Install pyenv, if you want more information you can go to Github repository.

brew update
brew install pyenv

After installation

Add to your zsh profile the following:

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc

Install pyenv-virtualenv

brew install pyenv-virtualenv

Install specific version

pyenv install 3.7

Virtual Environment

Create a virtual environment

mkdir project && cd project
pyenv virtual <version python> <env name>

Activate environment

pyenv activate <env name>

Deactivate environment

pyenv deactivate


Upgrading wiht Homebrew

brew upgrade pyenv


Uninstall pyenv

brew uninstall pyenv