pyenv zlib error on MacOS:
On Mojave, after installing Xcode command line tools, had to run the following:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
brew install zlib
export LDFLAGS="-L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include"
pyenv install 3.7.2
Samsin's answer didn't work for me. I didn't have a Packages
dir
On MacOS 11.1 (Big Sur) I eventually needed:
brew install bzip2
export LDFLAGS="-L $(xcrun --show-sdk-path)/usr/lib -L brew --prefix bzip2/lib"
export CFLAGS="-L $(xcrun --show-sdk-path)/usr/include -L brew --prefix bzip2/include"
pyenv install 3.9.0
I added the export commands in ./bash_profile so next time I can just use pyenv if I need to install more versions.
Keep an eye on : https://github.com/pyenv/pyenv/issues/1643 which tracks this, hopefully this will be fixed in pyenv.