Skip to content

Instantly share code, notes, and snippets.

@o3bvv
Last active March 2, 2021 11:01
Show Gist options
  • Save o3bvv/0cac49d3c68597d01625e47c1253883e to your computer and use it in GitHub Desktop.
Save o3bvv/0cac49d3c68597d01625e47c1253883e to your computer and use it in GitHub Desktop.
Installing Python from sources
#!/usr/bin/bash
CC=x86_64-linux-gnu-gcc
CFLAGS=-g -fstack-protector-strong -Wformat -Werror=format-security
LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2
CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2
configure --enable-optimizations --with-ensurepip=install --enable-shared --prefix=/usr/local/ --enable-loadable-sqlite-extensions --with-dbmliborder=bdb:gdbm --with-computed-gotos --with-system-expat --with-system-ffi
make # -j 4
make altinstall
#!/usr/bin/env python3
import sysconfig
# list flags used during compilation of Python
print(sysconfig.get_config_var('CONFIG_ARGS'))
# Ensure the path '/usr/local/lib' is present in config files
# inside the '/etc/ld.so.conf.d' dir.
# If no file contain the path, create a file, e.g. 'usr-local.conf', and put a line inside it:
/usr/local/lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment