How to upgrade the python version in PYNQ Z2 board

I have started using the Pynq z2 board for my project and I am a beginner. So i a tried a code for real time object detection using yolov3 in which there was a line cv2.dnn.readNet. when I tried to run this code it was showing an error like cv2 has no attribute called dnn.When I checked online for a solution to this problem I need to upgrade my python version to 3.7 or above, to support this command also opencv version should be-4.2.0.32 and numpy-1.18.2. My currnt python version in PYNQ is 2.5.7.
code is attached here by
import cv2
import numpy as np
import time
net = cv2.dnn.readNet(“yolov3.weights”, “yolov3.cfg”)
please help me to resolve this problem .

The PYNQ environment is incredibly similar to a stock Ubuntu one so any documentation out there that applies to Ubuntu is likely to work with PYNQ. Here’s the best resource I found on updating Python on Ubuntu -How to Install Python 3 on Ubuntu 18.04 or 20.04 {Step-by-Step}. Hopefully that can be useful.

Peter

thank you for the support. I will try it.