mac os mojave pyenv install python 3.6.x zipimport.ZipImportError: can't decompress data; zlib not available

結論

在你的 ~/.zshrc 或 ~/.profile
新增

# For compilers to find zlib you may need to set:
export LDFLAGS="${LDFLAGS} -L/usr/local/opt/zlib/lib"
export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/zlib/include"

# For pkg-config to find zlib you may need to set:
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/zlib/lib/pkgconfig"

#For compilers to find sqlite you may need to set:
export LDFLAGS="${LDFLAGS} -L/usr/local/opt/sqlite/lib"
export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/sqlite/include"

#For pkg-config to find sqlite you may need to set:
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/sqlite/lib/pkgconfig"

執行
source ~/.zshrc 或 source ~/.profile
brew install zlib
brew install sqlite
pyenv install 3.6.8

緣由

最近要維護一個舊案,重建環境時發現這問題。
參考
照打收工。

留言