Hi,
You can modify the CMake command to build the OpenCV library for python 3.7.
For example, below are steps for building OpenCV with python 3.9.
** Install NumPy for python 3.9
$ sudo -H python3.9 -m pip install numpy --upgrade numpy
** Update CMake command for python 3.9
https://github.com/AastaNV/JEP/blob/master/script/install_opencv4.6.0_Jetson.sh#L62
$ cmake \
-D PYTHON_LIBRARIES=/usr/lib/python3.9/config-3.9-aarch64-linux-gnu/libpython3.9.so \
-D PYTHON3_EXECUTABLE=/usr/bin/python3.9 \
-D WITH_CUDA=ON -D WITH_CUDNN=ON -D CUDA_ARCH_BIN="7.2,8.7" -D CUDA_ARCH_PTX="" -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-${version}/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
You should find python 3.9 in the CMake configuration:
-- General configuration for OpenCV 4.6.0 =====================================
...
-- Python 3:
-- Interpreter: /usr/bin/python3.9 (ver 3.9.5)
-- Libraries: /usr/lib/aarch64-linux-gnu/libpython3.9.so (ver 3.9.5)
-- numpy: /usr/local/lib/python3.9/dist-packages/numpy/core/include (ver 1.23.4)
-- install path: lib/python3.9/site-packages/cv2/python-3.9
--
...
Thanks.