Skip to content

Instantly share code, notes, and snippets.

@dankkom
Last active May 15, 2022 14:28
Show Gist options
  • Save dankkom/ece833b734e2519911f4ab7347188c73 to your computer and use it in GitHub Desktop.
Save dankkom/ece833b734e2519911f4ab7347188c73 to your computer and use it in GitHub Desktop.
Install Python from source code
apt update
apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev liblzma-dev
PYTHON_VERSION=3.10.1
N_PROCESSORS=$(nproc)
wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz
tar -xf "Python-$PYTHON_VERSION.tgz"
cd "Python-$PYTHON_VERSION"
./configure --enable-optimizations
make -j $N_PROCESSORS
make altinstall
cd ..
rm "Python-$PYTHON_VERSION.tgz"
rm -rf "Python-$PYTHON_VERSION"
@dankkom
Copy link
Author

dankkom commented May 15, 2022

Check currently available versions at: https://www.python.org/downloads/source/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment