Skip to content

Instantly share code, notes, and snippets.

@Mausy5043
Last active August 17, 2024 20:06
Show Gist options
  • Save Mausy5043/922ba4e459e62e097893ff16c17ea9a9 to your computer and use it in GitHub Desktop.
Save Mausy5043/922ba4e459e62e097893ff16c17ea9a9 to your computer and use it in GitHub Desktop.
build Python 3.12 on Raspberry Pi
# allow us to kill the SSH-connection while `make`ing
screen
# install dependencies
sudo apt-get -y install build-essential gdb lcov pkg-config \
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
libncurses5-dev libreadline-dev libsqlite3-dev libssl-dev \
lzma lzma-dev tk-dev uuid-dev zlib1g-dev # libmpdec-dev
# using /tmp because it has a lot of room (approx. 500MB is needed)
cd /tmp
# get the latest version
wget https://www.python.org/ftp/python/3.12.4/Python-3.12.4.tgz
tar -zxvf Python-3.12.4.tgz
cd Python-3.12.4
make clean
# configure with optimizations enabled
./configure --enable-optimizations --with-openssl-rpath=auto
# t=3m
# make using all cores
make -j 4
# t=60m
# install as alternative
sudo make altinstall
# t=3m
python 3.12 --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment