Is opencv dependent on python3.10

I am not sure if my problem is with opencv or GitHub. When I use GitHub via brew command to install opencv, there is a dependency for python3.10 so this only installs cv2 in a python3.10 directory. This causes a module not found error when attempting to import cv2 using the current version of python3.9.14.

why DIY when there are packages you can simply install with pip?

the official binary package of opencv-python is suitable for python 3.6+ because it uses a stable/reduced python ABI. there are binary builds for some recent apple OS versions, so you’d only have to build opencv and the python module yourself once your apple device is declared e-waste.

if you build opencv yourself, cmake will look for a python, any python, hopefully the latest version one, and pick that one python, and the generated “install” target will only copy the python module into that python.

I don’t know if the opencv source tree itself does the “reduced python ABI” building or whether the opencv-python build scripts do that specifically. I’d bet on the first, so probably the generated cv2.pyd should work with python 3.9 too, if you copy it into the right place.

related: python - With Homebrew opencv appears to be only for python3.10, any chance of getting a version for 3.9? - Stack Overflow

I’ll look into using PIP. I have always used Homebrew since it does not require me to DIY anything keeps different versions separate but it is dependent on the formula on GitHub. I did look at some of the packages installed for python3.10 since I was considering just moving them to the python3.9 directories but most all of them referenced the python3.10 path.

Thanks