Compile wxPython 4.2.0 from PyPI using pyenv 2.3.3 on Ubuntu 22.04
- Install pyenv using the installer
- Install suggested build environment to download and compile Python
- Install development packages for build wxPython
Set environment variables for OpenSSL:
OPENSSL_DIR=/usr/local/ssl
LD_LIBRARY_PATH=${OPENSSL_DIR}/lib
wget -q https://www.openssl.org/source/openssl-1.1.1q.tar.gz
tar -xzf openssl-1.1.1q.tar.gz
pushd openssl-1.1.1q
./config --prefix=${OPENSSL_DIR} --openssldir=${OPENSSL_DIR} shared zlib
make
sudo make install
popd
rm -rf openssl-1.1.1 openssl-1.1.1.tar.gz
Build Python with --enable-shared
CPPFLAGS="-O2 -I${OPENSSL_DIR}/include" \
CFLAGS="-I${OPENSSL_DIR}/include" \
LD_FLAGS="-L${LD_LIBRARY_PATH} -Wl,-rpath,${LD_LIBRARY_PATH}" \
LD_RUN_PATH="${LD_LIBRARY_PATH}" \
CONFIGURE_OPTS="--with-openssl=${OPENSSL_DIR}" \
PYTHON_CONFIGURE_OPTS="--enable-shared" \
pyenv install 3.10.6
attrdict3 needed for build wxPython 4.2.0 see issue
pyenv global 3.10.6
pyenv exec python -m pip install attrdict3 # issue/2225
pyenv exec python -m pip install wxpython
pyenv exec python -c "import wx; print(wx.version());"