[Python] Pyenv unable to install older versions of Python 3 due to `configure: error: C...

Discussão em 'Python' iniciado por Stack, Julho 20, 2025.

  1. Stack

    Stack Membro Participativo

    I've been trying to use pyenv to install older versions of python3. I've tried 3.0.1, 3.1.0, 3.1.1, and 3.1.2. I kept getting the error

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


    Following some documentation from pyenv I tried updating my command to explicitly pass the location of the headers and libraries like so:

    ➜ CPPFLAGS="-I/usr/bin/openssl/include" \
    LDFLAGS="-L/usr/bin/openssl/lib" \
    pyenv install -v 3.1.2


    That seems to have gotten past that error but now I'm getting the error configure: error: C compiler cannot create executables

    The only suggestion I can find for Ubuntu is to install/update the build-essential package which I've done and was already installed and fully updated.

    I can see that the gcc command is working. So what else am I missing?

    Full Error


    ➜ CPPFLAGS="-I/usr/bin/openssl/include" \
    LDFLAGS="-L/usr/bin/openssl/lib" \
    pyenv install -v 3.1.2
    /tmp/python-build.20230107155624.97473 ~/GitProjects/VWAP_backtest
    Downloading Python-3.1.2.tar.gz...
    -> https://www.python.org/ftp/python/3.1.2/Python-3.1.2.tgz
    /tmp/python-build.20230107155624.97473/Python-3.1.2 /tmp/python-build.20230107155624.97473 ~/GitProjects/VWAP_backtest
    Installing Python-3.1.2...
    patching file ./setup.py
    patching file ./Lib/ssl.py
    patching file ./Modules/_ssl.c
    checking for --enable-universalsdk... no
    checking for --with-universal-archs... 32-bit
    checking MACHDEP... linux5
    checking machine type as reported by uname -m... x86_64
    checking for --without-gcc... no
    checking for gcc... gcc
    checking for C compiler default output file name...
    configure: error: C compiler cannot create executables
    See `config.log' for more details.

    BUILD FAILED (Ubuntu 22.04 using python-build 2.3.9-18-g25c974d5)

    Continue reading...

Compartilhe esta Página