Skip to content

Instantly share code, notes, and snippets.

@joseph0x45
Last active June 23, 2025 16:00
Show Gist options
  • Select an option

  • Save joseph0x45/a144fff6be768f4cda2793a45d28c519 to your computer and use it in GitHub Desktop.

Select an option

Save joseph0x45/a144fff6be768f4cda2793a45d28c519 to your computer and use it in GitHub Desktop.
Build Python from source on Void Linux

How to build Python from source

Download the source code from Python's website

Instsall required dependencies for compiling Python

sudo xbps-install -S \
  gcc make libffi-devel zlib-devel \
  bzip2-devel xz-devel sqlite-devel \
  openssl-devel readline-devel ncurses-devel \
  gdbm-devel tk-devel libuuid-devel libnsl-devel

Configure Build

Run

./configure --prefix=<PATH> --enable-optimizations --with-lto --enable-shared
  • --enable-optimizations enables profile-guided optimizations
  • --with-lto enables link time optimizations
  • --enable-shared allows dynamic linking

Build and install

  • Compile using all cores
make -j$(nproc)
  • Install
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment