環境
- macOS Sierra 10.12.2
症状
pyenvでpythonをインストールしようとしたところ、以下のようなエラーが出て失敗した。
$ pyenv install 2.7.xx
Installing Python-2.7.xx...
ERROR: The Python zlib extension was not compiled. Missing the zlib?
Please consult to the Wiki page to fix the problem.
https://github.com/yyuu/pyenv/wiki/Common-build-problems
BUILD FAILED
対処法
メッセージに書かれているページによると、以下のように入力すれば良いらしい。
$ CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install -v 2.7.xx
これで治らなかった場合は、XCode command line toolsの再インストールをしろと書かれている。
$ xcode-select --install