CMake配置OpenCV時,顯示錯誤:find_host_package(PythonInterp 2.7)' found wrong Python version

CMake配置OpenCV時,顯示錯誤:find_host_package(PythonInterp 2.7)' found wrong Python version

問題描述:

CMake配置OpenCV時,顯示錯誤:find_host_package(PythonInterp 2.7)' found wrong Python version,具體提示如下:

Found PythonInterp: C:/Users/LiuBing/AppData/Local/Programs/Python/Python38/python.exe (found suitable version "3.8.2", 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:/Users/LiuBing/AppData/Local/Programs/Python/Python38/python.exe

  PYTHON_VERSION_STRING=3.8.2

  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)

解決方案:

桌面“計算機”右鍵選擇“屬性”,在彈出“系統”窗口左側選擇“高級系統設置”,彈出“系統屬性窗口”。

依次選擇“系統屬性”>>>“高級”>>>“環境變量”,彈出“環境變量”窗口。

“系統變量”欄選擇“新建”,按下圖操作:

設置完畢後,重啓電腦。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章