xref: /aosp_15_r20/external/pytorch/scripts/get_python_cmake_flags.py (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1## @package get_python_cmake_flags
2# Module scripts.get_python_cmake_flags
3##############################################################################
4# Use this script to find your preferred python installation.
5##############################################################################
6#
7# You can use the following to build with your preferred version of python
8# if your installation is not being properly detected by CMake.
9#
10#   mkdir -p build && cd build
11#   cmake $(python ../scripts/get_python_cmake_flags.py) ..
12#   make
13#
14
15
16import sys
17import sysconfig
18
19
20flags = [
21    f"-DPython_EXECUTABLE:FILEPATH={sys.executable}",
22]
23
24print(" ".join(flags), end="")
25