Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The Python zlib extension was not compiled on Mac OS X 10.11.1

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
like image 623
fukudama Avatar asked Oct 20 '25 03:10

fukudama


2 Answers

I went through the same issue and what did the trick for me was:

  1. (Re)install zlib:
$ brew reinstall zlib
  1. Set its path to some env vars so compilers and 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"
  1. Build Python again.
like image 196
Tiago G. Avatar answered Oct 22 '25 16:10

Tiago G.


You should check here: https://github.com/yyuu/pyenv/wiki/Common-build-problems. Try to reinstall your command line tools.

like image 33
MikeZhang Avatar answered Oct 22 '25 16:10

MikeZhang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!