I am using cmake3.17.3-GUI
to build opencv4.3.0
in the windows10-vs2015
environment. Both python 2.7 and 3.7 are installed in my PC.
Configuring the CMake shows the warning message:
Found PythonInterp: C:/Python37/python.exe (found suitable version "3.7.7", minimum required is "2.7")
CMake Warning at cmake/OpenCVDetectPython.cmake:81 (message):
CMake's 'find_host_package(PythonInterp 2.7)' found wrong Python version:
PYTHON_EXECUTABLE=C:/Python37/python.exe
PYTHON_VERSION_STRING=3.7.7
Consider providing the 'PYTHON2_EXECUTABLE' variable via CMake command line
or environment variables
Call Stack (most recent call first):
cmake/OpenCVDetectPython.cmake:271 (find_python)
CMakeLists.txt:598 (include)
Also it shows that:
Python 2:
Interpreter: C:/Python27/ArcGIS10.7/python.exe (ver 2.7.16)
Libraries: C:/Python27/ArcGIS10.7/libs/python27.lib (ver 2.7.16)
numpy: C:/Python27/ArcGIS10.7/lib/site-packages/numpy/core/include (ver 1.9.3)
install path: C:/Python27/ArcGIS10.7/Lib/site-packages/cv2/python-2.7
Python 3:
Interpreter: C:/Python37/python.exe (ver 3.7.7)
Libraries: C:/Python37/libs/python37.lib (ver 3.7.7)
numpy: C:/Python37/lib/site-packages/numpy/core/include (ver 1.18.5)
install path: C:/Python37/Lib/site-packages/cv2/python-3.7
Python (for build): C:/Python27/ArcGIS10.7/python.exe
Here is a screenshot regarding the python setup in the CMake interface:
How to force Cmake to use Python 3.7 for build?