From dc9b3f4441d2d70b82733a21874e76a7f1f2cfb2 Mon Sep 17 00:00:00 2001 From: Darius Tan Date: Thu, 27 May 2021 22:22:18 +1200 Subject: [PATCH] Explicitly pass PYTHON_INCLUDE_DIR and PYTHON_LIBRARY to CMake to avoid using macOS's default Python2 headers. --- setup.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 25e3415a..2e23e506 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,8 @@ import os import re -import sys import platform +import sys +import sysconfig import subprocess from setuptools import setup, Extension @@ -43,7 +44,10 @@ def build_extension(self, ext): '-DKOMPUTE_OPT_BUILD_PYTHON=1', '-DKOMPUTE_OPT_ENABLE_SPDLOG=0', '-DKOMPUTE_OPT_REPO_SUBMODULE_BUILD=1', - '-DPYTHON_EXECUTABLE=' + sys.executable] + '-DPYTHON_EXECUTABLE=' + sys.executable, + '-DPYTHON_INCLUDE_DIR=' + sysconfig.get_path('include'), + '-DPYTHON_LIBRARY=' + sysconfig.get_path('stdlib'), + ] cfg = 'Debug' if self.debug else 'Release' build_args = ['--config', cfg]