Install Python 3 on a Raspberry Pi

This tutorial will show you how to install Python 3 on a Raspberry Pi

sudo apt-get update
sudo apt-get install libssl-dev openssl

Get Python 3 package, configure, make, and install.

wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz
tar xvf Python-3.4.3.tar.xz
cd Python-3.4.3/
./configure # You can set a prefix here
make
sudo make install

Create a virtualenv and download the right libs

I’m pretty sure that if you want to download and compile the latest Python version, you also know what’s a virtualenv. If not, here is a guide. But did you know that Python 3.4 comes with an integrated virtualenv ? It’s called pyvenv-3.4. Once you have created a virtualenv (as described below) you’ll need to install the RPi.GPIO package with pip. Here is the list of command lines that allows you to do that.

pyvenv-3.4 env
source env/bin/activate
# If (and only if) source doesn't work :
. env/bin/activate

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.