如何使用Cmake使用python 3而不是python 2构建opencv
我正在使用如何使用Cmake使用python 3而不是python 2构建opencv,opencv,cmake,Opencv,Cmake,我正在使用cmake3.17.3-GUI在windows10-vs2015环境中构建opencv4.3.0。Python2.7和3.7都安装在我的电脑中 配置CMake将显示警告消息: Found PythonInterp: C:/Python37/python.exe (found suitable version "3.7.7", minimum required is "2.7") CMake Warning at cmake/OpenCVDetectPython.cmake:81 (m
cmake3.17.3-GUI
在windows10-vs2015
环境中构建opencv4.3.0
。Python2.7和3.7都安装在我的电脑中
配置CMake将显示警告消息:
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)
它还表明:
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
以下是关于CMake界面中python设置的屏幕截图:
如何强制Cmake使用PYTHON3.7进行构建?看起来使用可选的Python组件进行构建最好是通过将几个
PYTHON3.*
变量传递给Cmake,如图所示。你能提供你传递给CMake的变量列表,或者显示你在CMake GUI中定义的变量列表吗?我更新了帖子。python配置由CMAKE自动设置,这是否回答了您的问题?看起来使用可选Python组件进行构建的最佳方法是将几个PYTHON3.*
变量传递给CMake,如图所示。你能提供你传递给CMake的变量列表,或者显示你在CMake GUI中定义的变量列表吗?我更新了帖子。python配置由CMAKE自动设置,这是否回答了您的问题?