Skip to content

Instantly share code, notes, and snippets.

@PhilCS
Forked from miditkl/raspberry_python.sh
Last active June 23, 2023 23:34
Show Gist options
  • Save PhilCS/c27b37ed70cf84326e63f8bad75ca0dc to your computer and use it in GitHub Desktop.
Save PhilCS/c27b37ed70cf84326e63f8bad75ca0dc to your computer and use it in GitHub Desktop.
A shell script for installing Python 3.10.12 on your Raspberry Pi.
#!/bin/bash
# A bash script for installing Python 3.10.12 on your Raspberry Pi.
# (c) 2022 Valentin B. / Midian T. E.
#
# Open your terminal and type the following command:
# sudo wget https://gist.github.com/PhilCS/c27b37ed70cf84326e63f8bad75ca0dc/raw/raspberry_python.sh && sudo chmod +x raspberry_python.sh && ./raspberry_python.sh
sudo apt-get update -y
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install build-essential libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libc6-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libsqlite3-dev tk-dev libssl-dev openssl libffi-dev -y
mkdir Python-Installation
cd Python-Installation
wget https://www.python.org/ftp/python/3.10.12/Python-3.10.12.tgz
tar xzvf Python-3.10.12.tgz
rm -f Python-3.10.12.tgz
cd Python-3.10.12
sudo ./configure --enable-optimizations
sudo make -j 4
sudo make altinstall
cd ../..
sudo rm -rf Python-Installation
sudo apt-get --purge remove build-essential libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libc6-dev libz2-dev libexpat1-dev liblzma-dev zlib1g-dev libsqlite3-dev tk-dev libssl-dev openssl libffi-dev -y
sudo apt-get autoremove -y
sudo apt-get clean
python3.10.12 -m pip install --upgrade pip
sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.10 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment