I am using Ubuntu 22.04 and anacondna3. The python version in virtual environment is 3.10. Both Cmake, make -j6 and make install did not throw any errors. I am getting no module “cv2” error. Please help
My CMake command is below.
CMakeCache.txt,
CMakeVars.txt
cmake \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_QT=OFF \
-D WITH_CUDA=ON \
-D WITH_CUDNN=ON \
-D WITH_CUBLAS=ON \
-D WITH_TBB=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D CUDA_ARCH_BIN=7.5 \
-D OPENCV_EXTRA_MODULES_PATH=/home/suresh/Downloads/opencv_contrib-4.6.0/modules \
-D BUILD_EXAMPLES=ON \
-D WITH_OPENJPEG=OFF \
-D WITH_IPP=OFF \
-D PYTHON3_INCLUDE_DIR=/home/suresh/anaconda3/envs/cv46/include/python3.10 \
-D PYTHON3_LIBRARY=/home/suresh/anaconda3/lib/libpython3.so \
-D PYTHON3_PACKAGES_PATH=/home/suresh/anaconda3/envs/cv46/lib/python3.10/site-packages \
-D PYTHON3_EXECUTABLE=/home/suresh/anaconda3/envs/cv46/bin/python3 \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
..
The pkg-config shows opencv4 version correctly
(cv46) ➜ build pkg-config --modversion opencv4
4.6.0
When I try the below python command, I am getting No module named “cv2” error.
(cv46) ➜ build python3 -c "import cv2; print(cv2.__version__)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'