Caffe2 - Python API
A deep learning, cross platform ML framework
get_python_cmake_flags.py
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 from __future__ import absolute_import
16 from __future__ import unicode_literals
17 from __future__ import print_function
18 from distutils import sysconfig
19 import sys
20 
21 flags = [
22  '-DPYTHON_EXECUTABLE:FILEPATH={}'.format(sys.executable),
23  '-DPYTHON_INCLUDE_DIR={}'.format(sysconfig.get_python_inc()),
24 ]
25 
26 print(' '.join(flags), end='')