| 1 | initial version |
If you installed OpenCV from package manager, it's best to remove those packages. Check: apt list --installed | grep opencv.
If you built it yourself, and you still got the build folder, run sudo make uninstall from the OpenCV build directory. If you don't have the build directory, you'll find the OpenCV files in /usr/local/lib and usr/local/include. Don't forget to remove /usr/local/lib/pkgconfig/opencv.pc' and run sudo ldconfig.
P.S. You didn't specify what OS are you using, this is for Debian/Ubuntu/variants. However the procedure should be similar on other Linux and probably MacOS too.