Python can be complicated to set up, particularly if using virtual environments.
I used to setup Python via Miniconda in order to have virtual python environments (see this guide here. However, I don't like this approach because miniconda seems to be too aggressive in always preferring its own install. For example, the PDE Solver software Firedrake does not like Miniconda/Anaconda.
Instead, so far I really like the use of pyenv.
Setup seems quite simple. On Mac, use homebrew to install via
- brew install pyenv
You then need to include some scripts in your startup shell.
Then install a distribution via
- pyenv install 3.12
will install the latest version of Python 3.12. Then you can select this distribution to use as your global one:
- pyenv global 3.12