Skip to content

Instantly share code, notes, and snippets.

@dschep
Forked from BMeu/raspbian-python3.5.rst
Last active October 7, 2025 10:31
Show Gist options
  • Save dschep/24aa61672a2092246eaca2824400d37f to your computer and use it in GitHub Desktop.
Save dschep/24aa61672a2092246eaca2824400d37f to your computer and use it in GitHub Desktop.

Revisions

  1. dschep revised this gist Apr 4, 2018. 2 changed files with 6 additions and 6 deletions.
    10 changes: 5 additions & 5 deletions raspbian-python3.6.rst
    Original file line number Diff line number Diff line change
    @@ -18,9 +18,9 @@ it ourselves, and here is how to do it. There is also an ansible role attached t

    .. code-block:: bash
    $ wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
    $ tar xf Python-3.6.4.tar.xz
    $ cd Python-3.6.4
    $ wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
    $ tar xf Python-3.6.5.tar.xz
    $ cd Python-3.6.5
    $ ./configure
    $ make
    $ sudo make altinstall
    @@ -31,8 +31,8 @@ it ourselves, and here is how to do it. There is also an ansible role attached t

    .. code-block:: bash
    $ sudo rm -r Python-3.6.4
    $ rm Python-3.6.4.tar.xz
    $ sudo rm -r Python-3.6.5
    $ rm Python-3.6.5.tar.xz
    $ sudo apt-get --purge remove build-essential tk-dev
    $ sudo apt-get --purge remove libncurses5-dev libncursesw5-dev libreadline6-dev
    $ sudo apt-get --purge remove libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev
    2 changes: 1 addition & 1 deletion raspbian-python3.6.yml
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@
    ---
    - hosts: all
    vars:
    version: 3.6.4
    version: 3.6.5
    threads: 4
    tasks:
    - name: "python{{version}} runtime&build dependencies"
  2. dschep revised this gist Mar 18, 2018. 2 changed files with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion raspbian-python3.6.rst
    Original file line number Diff line number Diff line change
    @@ -32,7 +32,7 @@ it ourselves, and here is how to do it. There is also an ansible role attached t
    .. code-block:: bash
    $ sudo rm -r Python-3.6.4
    $ rm Python-3.6.4.tgz
    $ rm Python-3.6.4.tar.xz
    $ sudo apt-get --purge remove build-essential tk-dev
    $ sudo apt-get --purge remove libncurses5-dev libncursesw5-dev libreadline6-dev
    $ sudo apt-get --purge remove libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev
    File renamed without changes.
  3. dschep revised this gist Mar 18, 2018. 2 changed files with 60 additions and 3 deletions.
    57 changes: 57 additions & 0 deletions python3.6.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,57 @@
    # An ansible role to configure python3.6 on a Raspberry Pi.
    # to get started, ensure you have ansible installed:
    # $ sudo apt install ansible
    # Then run this playbook:
    # $ ansible-playbook -i localhost, python3.6.yml
    # Then you can get started:
    # $ python3.6
    #
    ---
    - hosts: all
    vars:
    version: 3.6.4
    threads: 4
    tasks:
    - name: "python{{version}} runtime&build dependencies"
    become: yes
    apt: name={{item}}
    with_items:
    - build-essential
    - tk-dev
    - libncurses5-dev
    - libncursesw5-dev
    - libreadline6-dev
    - libdb5.3-dev
    - libgdbm-dev
    - libsqlite3-dev
    - libssl-dev
    - libbz2-dev
    - libexpat1-dev
    - liblzma-dev
    - zlib1g-dev
    - name: "Download python{{version}}"
    get_url:
    url="https://www.python.org/ftp/python/{{version}}/Python-{{version}}.tar.xz"
    dest="/tmp/Python-{{version}}.tar.xz"
    - name: "Unarchive python{{version}}"
    unarchive:
    src="/tmp/Python-{{version}}.tar.xz"
    dest="/tmp/"
    copy=no
    creates="/tmp/Python-{{version}}"
    - name: "configure python{{version}} build"
    command: ./configure
    args:
    chdir: "/tmp/Python-{{version}}"
    creates: "/tmp/Python-{{version}}/Makefile"
    - name: "build python{{version}}"
    # not using make module to be able to use -j and creates option to fully skip step
    command: make -j{{threads}}
    args:
    chdir: "/tmp/Python-{{version}}"
    creates: "/tmp/Python-{{version}}/python"
    - name: "install python{{version}}"
    become: yes
    make:
    chdir: "/tmp/Python-{{version}}"
    target: altinstall
    6 changes: 3 additions & 3 deletions raspbian-python3.6.rst
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    Installing Python 3.6 on Raspbian
    =================================

    As of January 2017, Raspbian does not yet include the latest Python release, Python 3.6. This means we will have to build
    it ourselves, and here is how to do it.
    As of January 2018, Raspbian does not yet include the latest Python release, Python 3.6. This means we will have to build
    it ourselves, and here is how to do it. There is also an ansible role attached that automates it all for you.

    1. Install the required build-tools (some might already be installed on your system).

    @@ -25,7 +25,7 @@ it ourselves, and here is how to do it.
    $ make
    $ sudo make altinstall
    4. Optionally: Delete the source code and uninstall the previously installed packages. When
    3. Optionally: Delete the source code and uninstall the previously installed packages. When
    uninstalling the packages, make sure you only remove those that were not previously installed
    on your system. Also, remember to adjust version numbers if necesarry.

  4. dschep revised this gist Mar 18, 2018. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions raspbian-python3.6.rst
    Original file line number Diff line number Diff line change
    @@ -18,9 +18,9 @@ it ourselves, and here is how to do it.

    .. code-block:: bash
    $ wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
    $ tar xf Python-3.6.0.tar.xz
    $ cd Python-3.6.0
    $ wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
    $ tar xf Python-3.6.4.tar.xz
    $ cd Python-3.6.4
    $ ./configure
    $ make
    $ sudo make altinstall
    @@ -31,8 +31,8 @@ it ourselves, and here is how to do it.

    .. code-block:: bash
    $ sudo rm -r Python-3.6.0
    $ rm Python-3.6.0.tgz
    $ sudo rm -r Python-3.6.4
    $ rm Python-3.6.4.tgz
    $ sudo apt-get --purge remove build-essential tk-dev
    $ sudo apt-get --purge remove libncurses5-dev libncursesw5-dev libreadline6-dev
    $ sudo apt-get --purge remove libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev
  5. dschep revised this gist Feb 4, 2017. 1 changed file with 1 addition and 4 deletions.
    5 changes: 1 addition & 4 deletions raspbian-python3.6.rst
    Original file line number Diff line number Diff line change
    @@ -9,10 +9,7 @@ it ourselves, and here is how to do it.
    .. code-block:: bash
    $ sudo apt-get update
    $ sudo apt-get install build-essential tk-dev
    $ sudo apt-get install libncurses5-dev libncursesw5-dev libreadline6-dev
    $ sudo apt-get install libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev
    $ sudo apt-get install libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev
    $ sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev
    If one of the packages cannot be found, try a newer version number (e.g. ``libdb5.4-dev`` instead of ``libdb5.3-dev``).

  6. dschep renamed this gist Jan 9, 2017. 1 changed file with 12 additions and 22 deletions.
    34 changes: 12 additions & 22 deletions raspbian-python3.5.rst → raspbian-python3.6.rst
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    Installing Python 3.5 on Raspbian
    Installing Python 3.6 on Raspbian
    =================================

    As of October 2016, Raspbian does not yet include the latest Python release, Python 3.5. This means we will have to build
    As of January 2017, Raspbian does not yet include the latest Python release, Python 3.6. This means we will have to build
    it ourselves, and here is how to do it.

    1. Install the required build-tools (some might already be installed on your system).
    @@ -16,38 +16,26 @@ it ourselves, and here is how to do it.
    If one of the packages cannot be found, try a newer version number (e.g. ``libdb5.4-dev`` instead of ``libdb5.3-dev``).

    2. Download and install Python 3.5. When downloading the source code, select the most recent release of Python 3.5, available
    2. Download and install Python 3.6. When downloading the source code, select the most recent release of Python 3.6, available
    on the `official site <https://www.python.org/downloads/source/>`_. Adjust the file names accordingly.

    .. code-block:: bash
    $ wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
    $ tar zxvf Python-3.5.2.tgz
    $ cd Python-3.5.2
    $ ./configure --prefix=/usr/local/opt/python-3.5.2
    $ wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
    $ tar xf Python-3.6.0.tar.xz
    $ cd Python-3.6.0
    $ ./configure
    $ make
    $ sudo make install
    3. Make the compiled binaries globally available.

    .. code-block:: bash
    $ sudo ln -s /usr/local/opt/python-3.5.2/bin/pydoc3.5 /usr/bin/pydoc3.5
    $ sudo ln -s /usr/local/opt/python-3.5.2/bin/python3.5 /usr/bin/python3.5
    $ sudo ln -s /usr/local/opt/python-3.5.2/bin/python3.5m /usr/bin/python3.5m
    $ sudo ln -s /usr/local/opt/python-3.5.2/bin/pyvenv-3.5 /usr/bin/pyvenv-3.5
    $ sudo ln -s /usr/local/opt/python-3.5.2/bin/pip3.5 /usr/bin/pip3.5
    You should now have a fully working Python 3.5 installation on your Raspberry Pi!
    $ sudo make altinstall
    4. Optionally: Delete the source code and uninstall the previously installed packages. When
    uninstalling the packages, make sure you only remove those that were not previously installed
    on your system. Also, remember to adjust version numbers if necesarry.

    .. code-block:: bash
    $ sudo rm -r Python-3.5.2
    $ rm Python-3.5.2.tgz
    $ sudo rm -r Python-3.6.0
    $ rm Python-3.6.0.tgz
    $ sudo apt-get --purge remove build-essential tk-dev
    $ sudo apt-get --purge remove libncurses5-dev libncursesw5-dev libreadline6-dev
    $ sudo apt-get --purge remove libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev
    @@ -57,3 +45,5 @@ it ourselves, and here is how to do it.
    This guide is pretty much taken from the following tutorial:
    https://liudr.wordpress.com/2016/02/04/install-python-on-raspberry-pi-or-debian/
    and
    https://gist.github.com/BMeu/af107b1f3d7cf1a2507c9c6429367a3b
  7. @BMeu BMeu created this gist Oct 12, 2016.
    59 changes: 59 additions & 0 deletions raspbian-python3.5.rst
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    Installing Python 3.5 on Raspbian
    =================================

    As of October 2016, Raspbian does not yet include the latest Python release, Python 3.5. This means we will have to build
    it ourselves, and here is how to do it.

    1. Install the required build-tools (some might already be installed on your system).

    .. code-block:: bash
    $ sudo apt-get update
    $ sudo apt-get install build-essential tk-dev
    $ sudo apt-get install libncurses5-dev libncursesw5-dev libreadline6-dev
    $ sudo apt-get install libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev
    $ sudo apt-get install libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev
    If one of the packages cannot be found, try a newer version number (e.g. ``libdb5.4-dev`` instead of ``libdb5.3-dev``).

    2. Download and install Python 3.5. When downloading the source code, select the most recent release of Python 3.5, available
    on the `official site <https://www.python.org/downloads/source/>`_. Adjust the file names accordingly.

    .. code-block:: bash
    $ wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
    $ tar zxvf Python-3.5.2.tgz
    $ cd Python-3.5.2
    $ ./configure --prefix=/usr/local/opt/python-3.5.2
    $ make
    $ sudo make install
    3. Make the compiled binaries globally available.

    .. code-block:: bash
    $ sudo ln -s /usr/local/opt/python-3.5.2/bin/pydoc3.5 /usr/bin/pydoc3.5
    $ sudo ln -s /usr/local/opt/python-3.5.2/bin/python3.5 /usr/bin/python3.5
    $ sudo ln -s /usr/local/opt/python-3.5.2/bin/python3.5m /usr/bin/python3.5m
    $ sudo ln -s /usr/local/opt/python-3.5.2/bin/pyvenv-3.5 /usr/bin/pyvenv-3.5
    $ sudo ln -s /usr/local/opt/python-3.5.2/bin/pip3.5 /usr/bin/pip3.5
    You should now have a fully working Python 3.5 installation on your Raspberry Pi!

    4. Optionally: Delete the source code and uninstall the previously installed packages. When
    uninstalling the packages, make sure you only remove those that were not previously installed
    on your system. Also, remember to adjust version numbers if necesarry.

    .. code-block:: bash
    $ sudo rm -r Python-3.5.2
    $ rm Python-3.5.2.tgz
    $ sudo apt-get --purge remove build-essential tk-dev
    $ sudo apt-get --purge remove libncurses5-dev libncursesw5-dev libreadline6-dev
    $ sudo apt-get --purge remove libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev
    $ sudo apt-get --purge remove libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev
    $ sudo apt-get autoremove
    $ sudo apt-get clean
    This guide is pretty much taken from the following tutorial:
    https://liudr.wordpress.com/2016/02/04/install-python-on-raspberry-pi-or-debian/