tce-load -i compiletc sqlite3-dev tk-dev glib2-dev gdbm-dev mesa-dev liblzma-dev openssl-dev

wget https://www.python.org/ftp/python/3.6.14/Python-3.6.14.tar.xz

cd Python-3.6.14

edit setup.py
curses_includes.append('/usr/local/include/ncursesw')

CPPFLAGS="-I/usr/local/include/ncursesw" CC="gcc -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe" CXX="g++ -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local --localstatedir=/var --enable-shared --with-system-expat --with-system-ffi --with-ensurepip=yes --with-tcltk-includes='-I/usr/local/include' --with-tcltk-libs='-L/usr/local/lib -ltk8.6 -ltcl8.6'

find . -name Makefile -type f -exec sed -i 's/-g -O2//g' {} \;
find . -name Makefile -type f -exec sed -i 's/-g  -O3//g' {} \;
find . -name Makefile -type f -exec sed -i 's/flto-partition=none -g/flto-partition=none/g' {} \;

make [11m 6.14s]
sudo make install

sudo chmod 755 /usr/local/lib/libpython3.6m.so
sudo chmod 755 /usr/local/lib/libpython3.so

Python build finished successfully!
The necessary bits to build these optional modules were not found:
_dbm                  nis