Skip to content

Instantly share code, notes, and snippets.

@ph4ge
Last active April 23, 2024 06:26
Show Gist options
  • Save ph4ge/8d6cb60577910ef470eb962761f74b4b to your computer and use it in GitHub Desktop.
Save ph4ge/8d6cb60577910ef470eb962761f74b4b to your computer and use it in GitHub Desktop.
Download and compile Python3.10 version
Target system: Debian 12
========================
main ref: https://www.build-python-from-source.com
# install system dependencies
sudo apt update && sudo apt upgrade -y && sudo apt install git make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl xz-utils liblzma-dev wget
cd /tmp/
wget https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz
tar xvf Python-3.10.14.tgz
cd Python-3.10.14
sudo ./configure --prefix=/opt/python/3.10.14/ --enable-optimizations --with-lto --with-computed-gotos --with-system-ffi && sudo make -j `getconf _NPROCESSORS_ONLN` && sudo make altinstall && rm /tmp/Python-3.10.14.tgz
# install pip setup tools
sudo /opt/python/3.10.14/bin/python3.10 -m pip install --upgrade pip setuptools wheel
# create virtual env with newly installed binary
/opt/python/3.10.14/bin/python3.10 -m venv venv/py3.10
. venv/py3.10/bin/activate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment