The following build error occurred when I build Python 2.7.11.
ERROR: The Python zlib extension was not compiled. Missing the zlib?
My Build environment is:
- Mac OS X 10.11.1
- Python 2.7.11
You should check here: https://github.com/yyuu/pyenv/wiki/Common-build-problems. Try to reinstall your command line tools.
I went through the same issue and what did the trick for me was:
zlib
:$ brew reinstall zlib
pkg-config
can find zlib
:$ export LDFLAGS="-L/usr/local/opt/zlib/lib"
$ export CPPFLAGS="-I/usr/local/opt/zlib/include"
$ export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"
xcrun --show-sdk-path
gives the path in which you will find usr/include
and usr/lib
.
Oct 12, 2022 at 14:53
I found the great answer.
Run below command in the terminal to install the command line developer tools.
xcode-select --install
if you update to new mac os version, you may need upgrade pyenv first.
brew reinstall pyenv