October 19, 2024

When you install Python using pyenv install 3.11.1, the below error might occur.

ModuleNotFoundError: No module named ‘_ssl’
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

The below command would help you to install

CFLAGS=-I/usr/include/openssl LDFLAGS=-L/usr/lib pyenv install -v install 3.11.1
When it says
ModuleNotFoundError: No module named '_lzma'

It would help
sudo apt-get install lzma
sudo apt-get install liblzma-dev
sudo apt-get install libbz2-dev