Skip to content

Instantly share code, notes, and snippets.

@ashleyg
Forked from dschep/raspbian-python3.6.rst
Last active March 18, 2024 18:01
Show Gist options
  • Save ashleyg/02dbca187bd51dc9116a3c25f09c363b to your computer and use it in GitHub Desktop.
Save ashleyg/02dbca187bd51dc9116a3c25f09c363b to your computer and use it in GitHub Desktop.
Installing Python 3.6 on Raspbian

Installing Python 3.8 on Raspbian

As of January 2018, Raspbian does not yet include the latest Python release, Python 3.8. This means we will have to build it ourselves, and here is how to do it. There is also an ansible role attached that automates it all for you.

  1. Install the required build-tools (some might already be installed on your system).

    $ sudo apt-get update
    $ sudo apt-get install 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

    If one of the packages cannot be found, try a newer version number (e.g. libdb5.4-dev instead of libdb5.3-dev).

  2. Download and install Python 3.8. When downloading the source code, select the most recent release of Python 3.8, available on the official site. Adjust the file names accordingly.

    $ wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tar.xz
    $ tar xf Python-3.8.1.tar.xz
    $ cd Python-3.8.1
    $ ./configure
    $ make
    $ sudo make altinstall

This guide is pretty much taken from the following tutorial: https://liudr.wordpress.com/2016/02/04/install-python-on-raspberry-pi-or-debian/ and https://gist.github.com/BMeu/af107b1f3d7cf1a2507c9c6429367a3b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment