This problem occurs when installing Python 3.6.8. But version 3.6.10 installs successfully.
pyenv install 3.6.8
Downloading Python-3.6.8.tar.xz...
-> https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
Installing Python-3.6.8...
/home/altec/.pyenv/plugins/python-build/bin/python-build: line 1851: 158324 Segmentation fault (core dumped) "$PYTHON_BIN" -c "import $1"
WARNING: The Python ctypes extension was not compiled. Missing the libffi lib?
/home/altec/.pyenv/plugins/python-build/bin/python-build: line 2072: 158339 Segmentation fault (core dumped) "$PYTHON_BIN" $python_opts -m ensurepip ${ensurepip_opts} > /dev/null 2>&1
Installing pip from https://bootstrap.pypa.io/pip/3.6/get-pip.py...
/home/altec/.pyenv/plugins/python-build/bin/python-build: line 2048: 158355 Segmentation fault (core dumped) "${PYTHON_BIN}" -s "${get_pip}" ${GET_PIP_OPTS} 1>&4 2>&1
error: failed to install pip via get-pip.py
BUILD FAILED (Linuxmint 21.3 using python-build 2.3.36-1-g8f8a5e03)
Inspect or clean up the working tree at /tmp/python-build.20240218105827.146843
Results logged to /tmp/python-build.20240218105827.146843.log
Last 10 log lines:
install|*) ensurepip="" ;; \
esac; \
LD_LIBRARY_PATH=/tmp/python-build.20240218105827.146843/Python-3.6.8 ./python -E -m ensurepip \
$ensurepip --root=/ ; \
fi
Looking in links: /tmp/tmpi213cr64
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-18.1 setuptools-40.6.2
First I installed Python dependencies and build tools from https://github.com/pyenv/pyenv/wiki#suggested-build-environment.
Additionally installed libffi-dev: sudo apt-get install libffi-dev
This didn't solve the problem