Used this to build inside release
directory of opencv
To build OpenCV
inside the virtual environment offersTest
cmake -D WITH_CUDA=ON -D CUDA_ARCH_BIN="5.3" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.0.0/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D INSTALL_C_EXAMPLES=OFF -D BUILD_opencv_python3=ON -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D PYTHON_EXECUTABLE=~/.virtualenvs/offersTest/bin/python3 -D CMAKE_INSTALL_PREFIX=/usr/local ..
I wanted the OpenCV
to be installed inside the virtual environment offersTest
as i have specified the path here
-D PYTHON_EXECUTABLE=~/.virtualenvs/offersTest/bin/python3
during make -j2
the interpreter points to the correct location of the python
But during sudo make install
It prefers the minimum python version 2.7