diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4f534f2f..c6c0bc51 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,7 +37,10 @@ target_link_libraries(xfastertransformer add_dependencies(xfastertransformer_static ${DEPEND_LIST}) add_dependencies(xfastertransformer ${DEPEND_LIST}) -execute_process(COMMAND python -m pip show torch +find_package (Python COMPONENTS Interpreter Development) +message(STATUS "Using python: ${Python_EXECUTABLE}") + +execute_process(COMMAND ${Python_EXECUTABLE} -m pip show torch RESULT_VARIABLE EXIT_CODE OUTPUT_QUIET) if(${EXIT_CODE} EQUAL 0) diff --git a/src/pytorch/CMakeLists.txt b/src/pytorch/CMakeLists.txt index 14341236..a07622c5 100644 --- a/src/pytorch/CMakeLists.txt +++ b/src/pytorch/CMakeLists.txt @@ -18,7 +18,7 @@ find_package(OpenMP REQUIRED) find_package(MPI REQUIRED) find_package(oneCCL REQUIRED) -execute_process(COMMAND python -c "import torch.utils; print(torch.utils.cmake_prefix_path)" +execute_process(COMMAND ${Python_EXECUTABLE} -c "import torch.utils; print(torch.utils.cmake_prefix_path)" OUTPUT_VARIABLE TORCH_CMAKE_PREFIX_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)