Python环境设置-zlib not available
阅读原文时间:2023年07月09日阅读:3

今天在Linux中安Python3的时候,出现了一个错误:zipimport.ZipImportError: can‘t decompress data; zlib not available

网上找了各种办法都无法解决实际问题,记录下解决过程。

错误:

zipimport.ZipImportError: can't decompress data; zlib not available
Makefile:1079: recipe for target 'install' failed
make: *** [install] Error 1

解决办法:安装依赖

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev

重新 make && make install

参考:https://github.com/pyenv/pyenv/wiki/Common-build-problems

macOS

xcode-select --install
brew update
brew install pyenv
pyenv install 3.6.
pyenv global 3.6.