Skip to content

Instantly share code, notes, and snippets.

@automagictv
Last active September 27, 2022 02:36
Show Gist options
  • Save automagictv/e23597a9a9851e8350b9fc238f81b69c to your computer and use it in GitHub Desktop.
Save automagictv/e23597a9a9851e8350b9fc238f81b69c to your computer and use it in GitHub Desktop.
Raspberry Pi Python Configuration Instructions / commands.
# 1 - Download Dependencies
sudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev libxml2-dev libxslt-dev
# 2 - Download latest python from https://www.python.org/downloads/source/
# Make sure to update the version variable or all commands for python will fail
export PYTHONVER=3.9.4
wget https://www.python.org/ftp/python/$PYTHONVER/Python-$PYTHONVER.tar.xz
# 3 - Extract and configure
tar xf Python-$PYTHONVER.tar.xz
cd Python-$PYTHONVER
./configure --enable-optimizations
# 4 - Install python
sudo make && sudo make altinstall
# 5 - Install git
sudo apt-get install git
# 6 - Install pipx
# easiest to handle: https://www.ianwootten.co.uk/2021/11/29/how-to-setup-raspberry-pi-os-bullseye-like-a-python-pro/#pipenv
python3 -m pip install --user pipx
python3 -m pipx ensurepath
# 7 - Pipenv
pipx install pipenv
# 8 - Clean up
cd ..
sudo rm -r Python-$PYTHONVER
rm Python-$PYTHONVER.tar.xz
. ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment