Can’t fix “zipimport.ZipImportError: can’t decompress data; zlib not available” when I type in “python3.6 get-pip.py”

I also came across this problem (while creating a simple installer for pyenv). Here’s how I solved it for Mac and Linux:

Ubuntu 20.04, 18.04

You need the zlib development files, and probably zlib itself too:

sudo apt install -y zlib1g-dev zlibc

If you’re missing zlib, it’s likely that the next problem you’ll run into is with openssl, so it’s probably best to get that now as well:

sudo apt install -y libssl-dev
sudo apt install -y libssl1.1 || sudo apt install -y libssl1.0

macOS

I believe this comes with XCode CLI Tools (or at least I didn’t have to custom install it Big Sur):

xcode-select --install

Leave a Comment