Run Flask using python3 not python
There are several ways:
Virtualenv lets you create isolated python environments with different versions (this is the way I would recommend)
You can put
#!/usr/bin/python3
on top of your python file (see here)Or you can start your script with
python3 script.py
As mentioned in the comments above you can also start your script inside a Docker container that hosts a python3 installation