Linux and Python

Compile Python 3.4 on Raspbian

- 1 minutes read - 121 words

Recently I had to install Python 3.4 on the Raspberry Pi, which is not part of the current distribution as it is based on Debian Wheezy which includes Python 3.2.3.

The following steps allow you to install Python 3.4 with pip and sqlite support, without messing with your other Python versions.

First you have to install some prerequisites packages:

sudo apt-get install libssl-dev libsqlite3-dev libexpat1-dev build-essentials

Then download the tgz from the python website, extract and cd to the directory, then use the following commands to compile it properly:

./configure '--prefix=/usr/local' '--enable-ipv6' '--with-dbmliborder=bdb:gdbm' '--with-system-expat' '--with-system-ffi' '--with-fpectl' 'CC=gcc' 'CFLAGS=-D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-z,relro'
sudo make altinstall

This should also work on other linux distribution based on Debian Wheezy.

    comments powered by Disqus