meta data for this page

pyenv and MacPorts (Updated)

I've recently switched from HomeBrew to MacPorts for a number of reasons. MacPorts doesn't have a version of pyenv included, so it needs to be installed manually.

I kept running into issues where pyenv doctor would fail because of missing libraries/dependencies. The following fixed it:

sudo port install libffi libxml2  openssl readline sqlite3 xz zlib
export CPPFLAGS="-I/opt/local/include $CPPFLAGS"
export LDFLAGS="-L/opt/local/lib $LDFLAGS"


For some reason, I had no luck with the pyenv route, nor the MacPorts Python installations as Python 3.10, 3.11 and 3.12 kept crashing upon quit (or when running Jupyter notebooks). I removed pyenv and the MacPorts Python versions and installed the bog-standard official Python release from with pip install <module> –user in userspace. All seems to be fine since.


Enter your comment. Wiki syntax is allowed: