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?
➜ 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)
Looks like the libssl-dev
package is missing. Try installing that library along with some others you might have missed by using thepyenv build instructions .
In particular you should install the pyenv dependencies. For example for the Debian OS you would want:
sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.