--- Modules/FindPythonInterp.cmake +++ Modules/FindPythonInterp.cmake @@ -61,7 +61,7 @@ list(APPEND _Python_NAMES python) # Search for the current active python version first -find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES}) +find_program(PYTHON_EXECUTABLE NAMES python) # Set up the versions we know about, in the order we will search. Always add # the user supplied additional versions to the front. --- Modules/FindPythonLibs.cmake +++ Modules/FindPythonLibs.cmake @@ -68,6 +68,8 @@ UNSET(_PYTHON2_VERSIONS) UNSET(_PYTHON3_VERSIONS) +EXECUTE_PROCESS(COMMAND python -c "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:2]]))" + OUTPUT_VARIABLE _Python_VERSIONS) FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) IF(WIN32)