Tags All Entries

Python

Setting up python on macOS and zsh

Install pyenv and the useful plugins for virtualenv and virtualenv wrapper:

brew install pyenv pyenv-virtualenv  pyenv-virtualenvwrapper

You then have to hook pyenv into your shell:

 echo 'eval "$(pyenv init --path)"' >> ~/.zsh/pyenv_profile
 echo 'eval "$(pyenv init -)"' >> ~/.zsh/pyenv_zshrc

Restart your terminal. At this point you can install python versions like so:

pyenv install 3.10.0

You can install the latest version:

pyenv install $($PYENV_COMMAND install --list | grep --extended-regexp "^\s*[0-9][0-9.]*[0-9]\s*$" | tail -1 | xargs)

Links to this note