Reputation: 2306
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:
Upvotes: 4
Views: 11911
Reputation: 11
When installing Python 2.7.18 in Mac M1 (Apple Silicon) with the new 'brew' version that works in '/opt/hombrew', not in '/usr/local/opt':
export LDFLAGS="-L/opt/homebrew/opt/zlib/lib"
export CPPFLAGS="-I/opt/homebrew/opt/zlib/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig"
arch -x86_64 pyenv install 2.7.18
Upvotes: 1
Reputation: 139
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"
Upvotes: 7
Reputation: 124
if you update to new mac os version, you may need upgrade pyenv first.
brew reinstall pyenv
Upvotes: 0
Reputation: 337
You should check here: https://github.com/yyuu/pyenv/wiki/Common-build-problems. Try to reinstall your command line tools.
Upvotes: 5
Reputation: 2306
I found the great answer.
Run below command in the terminal to install the command line developer tools.
xcode-select --install
https://github.com/Homebrew/homebrew-python/issues/234
Upvotes: 1