The Mac does present some unique challenged 
A couple thoughts:
-
You really want one python system that you use for your own stuff, i.e. that would go on PATH.
-
Apple provides a system Python at:
/usr/bin
(actually, it look like they have a python2 and python3 now, at least on my system)
You don’t want to mess with that one, which means you don’t want to use it for your custom use, as you might (will) need to install additional packages, etc.
So it can happily be shadowned on your PATH – any system utilities that need it would be providing an explicit path to it.
- hombrew also provides Python – I haven’t used it for a while, so I can’t remember the detatils, but I imagine it is used by other stuff that homebrew installs, so it’s a bit like the system python. If you want to stay homebew focused, then it’s OK to use that Pytohn as your “user” python. Looking quickly at the homebrew docs:
indicates that, as a rule, anything that can be pip installed should be, rather than be a homebrew package. In fact, it says that a python-based appliation should “vender” any python dependencies.
SO using homebrew python as your Python should work fine – jsut make sure it’s on your PATH first.
-
Python.org distributes a Python installer – it’s separate from the system one (as it should be) – it’s “killer feature” is that it includes support for running GUI-based apps (Framework Python) – so if you want to run Python GUIs on your Mac, this is a great choice. (I don’t think homebrew supoert that, but maybe?)
-
The only other “easy” choice is conda Python. This can be installed either with the Anaconda system, or more simply with miniconda. Conda provides multipel versions of Python, and an environment system for managing it all – it is an fine choice, but only the obvious one if you use anything that is only (or most easily) available through conda – that used to be the “scipy Stack” but now most of the core scipy package can be pip installed, so it’s less killer, but it’s still the case (last I checked for the OSGEO stack (GDAL et al) and other “data science” stuff. Make sure you caheck out conda-forge – it GREATLY increases the number of pacakges available.
you mention poetry and pip – those are not Python installations, but tools that use an existing Python installation – they can be used with any of the above, though it’s better to use pip as little as possible with conda. (not sure how poetry interacts with conda)
Ideally I would like a single directory that everything got installed in like ~/.python. Is that possible and/or advisable?
no – not possible – each of the above will do it’s own thing. On the plus side, conda can (and it’s the default) puts everything inside your user dir – e.g. ~/miniconda
Once you choose which of the above you want to use, then all the others can be removed from your PATH
Also looking at pyenv or pipenv to help manage everything.
I’d say first steo is to decide if conda is right for you (It’s my personal go-to, and it’s NOT just for "data science:)
If you use conda, then use conda environments.
If you choose to use either homebrew Python or the Python.org Mac installers, then yes you will want o use either pyenv or pipenv (or virtualenv? I"ve lost track) – look elsewhere for advise on the that, it’s not Mac specific.
Final note about conda: if you go the conda route, I find it VERY helpful to set up a default environment that’s NOT the conda root environment. I have a “py3” environment that I activate in my startup script:
conda activate py3
in my .zshrc
file.
That way I can make a mess of it, and start again clean, without break ing my entire conda install. It could be handy to have conda_requirements.txt file with the stuff you usually want handy, so you can make a new “default” environment easily.
There’s probably a similar way to do the same thing with the various pip-based environment management tools.