Python Raspberry Pi

How to install Python 3.6 on Raspbian Linux for Raspberry Pi

Let’s walk through how to get Python 3.6 installed on Raspbian Linux for Raspberry Pi.

I’m assuming you have a recent copy of Raspbian (Jessie) for your Raspberry Pi. If not, either run apt-get to update or download the latest iso.

As I write this, the current distro of Raspbian (Jessie) includes Python 3.4.2. I had a specific requirement for 3.6.0. Here’s what I did to get it installed. Note these instructions would also work for 3.6.1.


Open the terminal (command prompt) and run the following commands. These will install the pre-requisites

Download Python 3.6

Next step is to download from the Python site. Once you’ve downloaded it you will need to extract it (hence line 3)

Compile Python

Next we need to compile. This step will take a while.

We’re using make altinstall make to avoid having replacing the default python binary file in /usr/bin/python.

All done!

If you want to confirm Python 3.6 is installed, run python3.6 -V. It should respond with Python 3.6.0


      1. I am the least knowledgeable person when it comes to linux. 🙂 I think I need to get it installed to /usr/bin?? python 2.7.1 and 3.4 are there. before I can get update-alternatives to work (or at least make sense)


      2. Let me try it and get back to you. If/when I figure it out I will update my post. BTW, I am still learning Linux as well. This blog shares what little I know (or what I’ve learned through painful trial and error!)


      3. I have tried the suggested method of changing default python and it seems to work really well. It uses a command ‘update-alternatives’ which ‘maintains symbolic links determining default commands’.

        There are often recommendations not to mess with default python command because of system requirements. But when I’m introducing a complete beginner to the command line, programming, and python, the last thing I want to be distracted by is explaining why ‘print()’ works in one place but not another. I just want to start with latest Python 3. I’ll deal with the version details much much later.

        By the way, thanks Ben for an excellent, concise how-to


  1. I have installed Python 3.6 successfully (and thanks!), but how can I configure Idle to default to Python 3.6 (instead of Python 3.5, which it currently runs)?


  2. tried this for my raspberry pi 0 and turned the sd card into a chip. the card no longer works boots but does not work. oh well guess ill have to keep digging


    1. I have had endless troubles with my setup. It ended up being a cheap SD card. Since I bought a sandisk I have had no problems even with this installation of Python. Give it a try. I hope it helps.


  3. Good article, just used it to install Python 3.7.2, just one note to add, you will need the libffi-dev library in your prerequisites or the make will fail at building the _ctypes module.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: