pyenv 安装 Python 版本问题:zipimport.ZipImportError: can't decompress data; zlib not available

pyenv 安装 Python 各种版本就一行命令:
pyenv install xxx

尝试过之后都报错:zipimport.ZipImportError: can't decompress data; zlib not available

解决办法

brew install zlib
brew install sqlite
export LDFLAGS="${LDFLAGS} -L/usr/local/opt/zlib/lib"
export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/zlib/include"
export LDFLAGS="${LDFLAGS} -L/usr/local/opt/sqlite/lib"
export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/sqlite/include"
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/zlib/lib/pkgconfig"
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/sqlite/lib/pkgconfig"

然后继续 pyenv install xxx
啊哈...解决问题了

如果是: pyenv BUILD FAILED
可以执行 pyenv update/brew upgrade pyenv/git pull

参考于:https://github.com/jiansoung/issues-list/issues/13

你可能感兴趣的:(pyenv 安装 Python 版本问题:zipimport.ZipImportError: can't decompress data; zlib not available)