Update Python to the new version 3.9

Based on h_t_t_p_s://www.home-assistant.io/docs/installation/raspberry-pi/ (my instalation) and some google search, i,ve update python 3.7.0 to 3.8.6 with no major problems, Just had to adjust some configuration in configuration.yaml, and just work like charm, and test in other instalation version 3.9.0 and run as well too, Hope this help:

#dont have to change anything in home assistant “boot”.

#With PI user

sudo apt-get update

sudo apt-get upgrade -y

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 python3 python3-dev python3-venv python3-pip libffi-dev libtiff-dev autoconf libopenjp2-7

wget -O /tmp/Python-3.8.6.tar.xz https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz

cd /tmp

tar xf Python-3.8.6.tar.xz

cd Python-3.8.6

./configure

sudo make altinstall

sudo apt -y autoremove

cd

rm -r /tmp/Python-3.8.6

rm /tmp/Python-3.8.6.tar.xz

sudo mv /srv/homeassistant /srv/homeassistant_old

cd /srv

sudo mkdir homeassistant

sudo chown homeassistant:homeassistant homeassistant

sudo -u homeassistant -H -s

cd /srv/homeassistant

/usr/local/bin/python3.8 -m venv .

source bin/activate

python3 -m pip install wheel

pip3 install homeassistant

pip3 install websocket-client #sonoff if add in costum components

pip3 install mysqlclient #mysql if run HA db in mariadb/mysql

hass # here we see the error´s and adjust config

for version 3.9.0 just change “3.8.6” to 3.9.0 and

“/usr/local/bin/python3.9 -m venv .”

#Best regards Igor

20 Likes