Skip to content

Instantly share code, notes, and snippets.

@s3rvac
Last active October 31, 2020 10:29
Show Gist options
  • Save s3rvac/6471a43bb151dc8427849838e596a4f0 to your computer and use it in GitHub Desktop.
Save s3rvac/6471a43bb151dc8427849838e596a4f0 to your computer and use it in GitHub Desktop.
Steps to build Python 3.9 on Debian Buster, including all modules.
#!/bin/bash
#
# Steps to build Python 3.9 on Debian Buster, including all modules.
#
set -e -x
# Install all dependencies.
export DEBIAN_FRONTEND=noninteractive
apt update
apt install -y wget xz-utils make gcc libssl-dev lzma-dev liblzma-dev libreadline-dev libbz2-dev libsqlite3-dev libgdbm-dev libgdbm-compat-dev uuid-dev libffi-dev tk-dev
# Download Python sources.
wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz
tar xf Python-3.9.0.tar.xz
cd Python-3.9.0
# Build and install it.
./configure --prefix=/opt/python-3.9 --enable-optimizations --enable-shared LDFLAGS="-Wl,--rpath=/opt/python-3.9/lib"
make -j$(nproc)
make install
# Create an archive of the installed version.
cd /opt
tar cvJf python-3.9.0-debian-buster.tar.xz python-3.9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment