When trying to install python 3.7 on Ubuntu 18.04

I get error messages like:

zipimport.ZipImportError: can't decompress data; zlib not available


ModuleNotFoundError: No module named '_ctypes'


~/.pyenv/plugins/python-build/bin/python-build: line 775: make: command not found


configure: error: no acceptable C compiler found in $PATH

  • How did you try to install Python? Compiling from upstream sources?
    – sebasth
    Apr 24 '19 at 18:19
  • I was using pyenv
    – lapolonio
    Apr 27 '19 at 2:58

From https://bugs.python.org/issue31652#msg321260

sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev zlib1g-dev libssl-dev openssl libgdbm-dev libgdbm-compat-dev liblzma-dev libreadline-dev libncursesw5-dev libffi-dev uuid-dev

Read the wiki at the pyenv project's repo on GitHub. Common build problems from pyenv wiki

Make sure to follow this guidance for your platform before any troubleshooting.


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 libffi-dev liblzma-dev python-openssl git

Alternative of libreadline-dev:

sudo apt install libedit-dev

Build dependencies on other distros are included in the wiki as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.