Tested on:RPi3; Raspbian Stretch
Prerequisites:Raspberry Pi with Raspbian Jessie and internet connection (see steps 1-7 in the Introduction)
16

Installing Python3.6 on a Raspberry Pi

I’m mostly happy with older Python versions, but Python3.6 offers a new method for string generation, the f-string syntax, which i prefer over older methods.

Installation
Enter in the terminal

Update command
Enter

and add at the end of the file

Save, then enter

Test
Start Python3 with

and enter in the IDE

Links
Realpython f-string syntax introduction: https://realpython.com/python-f-strings/

Knight of Pi

Johannes Bergs aka Knight of Pi. Diploma in Bioinformatics, some Webdesign and Python coding then. Living in the beautiful city of Vienna.

16 Comments

  1. Hi, I followed your instructions but the version displayed when is still 3.5.3…

  2. Err, Houston – we have a problem. I’m running Domoticz home automation on my RP3 and was trying to update Python to 3.6 on above instructions, but as a side effect this killed my Domoticz.
    As per /usr/bin/python3 –version I’m still on 3.5.3
    Domoticz error messages e.g:
    Error: WebServer(HTTP) startup failed on address 0.0.0.0 with port: 8080: bind: Address already in use
    Error: WebServer(HTTP) check if no other application is using port: 8080

    Error: #0 0x76e7851c in __waitpid (pid=2034, stat_loc=0x7eac69f8, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
    Error: #1 0x002d8840 in dumpstack_gdb(bool) ()
    … and so forth

    Any undo-advice would be highly appreciated, I’m really no pro on these

    • Hi johansson,
      It seems your problem is not related to Python: Domoticz can’t open a listening socket on the port 8080, because another program is already using it.
      It may be Domoticz himself.
      Try that command: netstat -tulpn | grep :8080
      The last column will give you the PID and the process name.
      Good luck !

  3. hi I did what you said, it was successful yet, when I type in my Debian linux command prompt it returns “Python 2.7.13”

    Please help and absolutely fresh to coding or programming

    • Hmmm. I just tried it on my Raspi which runs Raspbian, which is a Debian derivate. Don’t know why it doesn’t work for you. Maybe you need to use the command python3.6 for now.

  4. i’ve installed 3.6.3, but when i run python3 i’m still going to 3.5 … how do i change this?

Comment

Time limit is exhausted. Please reload CAPTCHA.