I’ve been using
pyenv for ages to manage my python
environments. I’ll leave singing the praises of this for others who do
it well. Bascially I have a custom python environment for pretty much
every project. This avoids dependency conflicts and ‘rot’ across projects.
It is an essential tool and I cannot imagine Python without it.
However, it is a bit difficult to remember the incantations needed to get it to build successfully on MacOS 10.15 and beyond. So I’m going to record this here and save myself the constant Google searching everytime I need to build a new environment or run into trouble. For bonus points I suppose I should add the error messages too so I can find this (and potentially others) while looking for how to solve the problem.
Building Python with
pyenv on MacOS Catalina (and later)
PYTHON_CONFIGURE_OPTS="--enable-framework" \ MACOSX_DEPLOYMENT_TARGET=10.15 \ SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk \ pyenv install -v 3.8.2
Change 3.8.2 to whatever mainline release you’d like to install.