Alex44 Alex44 - 10 months ago 107
Python Question

How to install Python 3.5 on Raspbian Jessie

I need to install Python 3.5+ on Rasbian (Debian for the Raspberry Pi). Currently only version 3.4 is supported. For the sources I want to compile I have to install:

sudo apt-get install -y python3 python-empy python3-dev python3-empy python3-nose python3-pip python3-setuptools python3-vcstool pydocstyle pyflakes python3-coverage python3-mock python3-pep8

But I think that
will install more than these packages, for example

I already install
from but I think, that is not complete.

Can you give me some suggestion which way is the best to get this?

A similar question was posted here Install Python 3.5 with pip on Debian 8 but this solution seems not to work on arm64.


regarding to the comment of Padraic Cunningham: The first step I have done before. The second one results into this:

$ sudo python3.5
Traceback (most recent call last):
File "", line 19177, in <module>
File "", line 194, in main
File "", line 82, in bootstrap
import pip
File "/tmp/tmpoe3rjlw3/", line 16, in <module>
File "/tmp/tmpoe3rjlw3/", line 9, in <module>
File "/tmp/tmpoe3rjlw3/", line 30, in <module>
File "/tmp/tmpoe3rjlw3/", line 39, in <module>
File "/tmp/tmpoe3rjlw3/", line 14, in <module>
File "/tmp/tmpoe3rjlw3/", line 66, in <module>
ImportError: cannot import name 'HTTPSHandler'

Answer Source

The suggestion of @Padraic Cunningham to install libssl header files was helpful.

sudo apt-get install libssl-dev

But after this I further had to install GCC higher version 5 and CMake higher 3.5. The new Raspian Stretch comes with Python 3.5 and additionally with GCC 6.1 and CMake 3.5.

So the easiest way was to upgrade my system to Stretch (at the moment under test):

sudo echo 'deb testing main contrib non-free rpi' > /etc/apt/sources.list.d/stretch.list
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get autoremove

This is quiet easy and always up to date. At the end this is my prefered solution :)