Skip to content

Instantly share code, notes, and snippets.

@shmidt
Last active November 8, 2020 04:11
Show Gist options
  • Save shmidt/ccb87708be6f137d0f7400ed9e519f7d to your computer and use it in GitHub Desktop.
Save shmidt/ccb87708be6f137d0f7400ed9e519f7d to your computer and use it in GitHub Desktop.
Install Python on Raspbian
# Thanks to https://www.ramoonus.nl/2020/10/06/how-to-install-python-3-9-on-raspberry-pi/
# sudo ./install_python.sh 3.9.0
version=$1
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
wget https://www.python.org/ftp/python/$version/Python-$version.tgz
tar zxf Python-$version.tgz
cd Python-$version
./configure --enable-optimizations --prefix=/usr/local/opt/python-$version
# ./configure --prefix=/usr/local/opt/python-$version
make -j4
sudo make altinstall
sudo update-alternatives --config python
# remove the files
cd ..
sudo rm -r Python-$version
rm Python-$version.tar.xz
echo 'python -V'
#cd /usr/local/bin
#sudo ln -sf python3.9 python3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment