You may not understand what I do… but it is still awesome.

Building and Installing Python 3.4 from source

This tutorial asssumes basic knowledge of the raspberry pi’s (or linux) terminal.

Since Raspberry Pis currently come with a slightly outdated version of Python 3, you may want to update it to a more recent version. The following instructions should work for any version of python – Python 3.4 is used here as an example. It is assumed that you are using the raspberry pi or another Linux operating system at all times.

  • Step 1: Go to the Python Download Page, and download the source release for the version of python that you want to use. Make sure that you are downloading the “Gzipped source tarball”.
  • Step 2: Open a terminal and cd to an empty temporary directory that we can use to extract the python source release.
  • Step 3: Type the following to extract the source code of your chosen version of python: tar -vxzf /home/pi/python-3.4.0.tgz. Replace /home/pi/python-3.4.0.tar.gz
  • Step 4: cd into the resulting directory.
  • Step 5: Enter the following commands in succession:
    make test
    sudo make install

    This will build and install python. If you are doing this for Python 2, it will install as Python 2 – Python 3 will install as Python 3. You can have both installed at once. Warning: It will take a long time! Do not attempt this until you have a few hours to spare.

Leave a Reply