Recently, I turned into a big fan of pyenv and poetry for managing my Python installation on macOS. The basic steps are easy but can get tricky.
Theses steps assume you have installed Homebrew. But of course you can also install pyenv with its own installer.
brew install pyenv
pyenv install 3.7.5
pyenv global 3.7.5pyenv needs some initialisation in your shell configuration. Just add the following to your ~/.zshrc or ~/.bashrc and source the config file. (Or if you want a more rustic solution, restart your shell.)
eval "$(pyenv init -)"After you have done that, pyenv is up and running. Your default Python version is 3.7.5 in your shell.
I normally install some handy tools, too.
pip3 install --upgrade setuptools pip flake8 isort black==19.10b0 pipdeptree ipython requests cookiecutter pre-commit safetyWhy 3.7.5?* I still prefer to use a patched stable version over a dotzero release. But I will switch to 3.8.1 as soon as it is available.
poetry is simply the best tool to manage your dependencies and virtual environments in a project. For me it is the killer app I have been waiting for and finally enjoy releasing Python projects. Until now the whole packaging system of Python has been a mess from my point of view.
Before installing poetry, we have to deactivate our shiny pyenv-powered Python installation and reactivate it afterwards. I also prefer to use the beta versions of poetry at the moment. Very stable and version 1.0.0 is coming soon.
pyenv shell system
curl -O https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
python get-poetry.py --preview
pyenv shell 3.7.5Now, everything is up and running to enjoy modern Python.