From 8ad94fedd8fa1d8e9669e245a492aabbf55c550d Mon Sep 17 00:00:00 2001 From: ARATA Mizuki Date: Thu, 2 Mar 2023 18:28:51 +0900 Subject: [PATCH] Pass -DPYTHON_EXECUTABLE to cmake This is important when using a virtualenv without activating it. --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5a31e28..d908019 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ import os +import sys import shutil from pathlib import Path from setuptools import setup, Extension @@ -20,7 +21,8 @@ def run(self): install_dir = os.path.join(build_dir, 'install') if not self.dry_run: cmake_args = ['cmake', '..', - '-DCMAKE_INSTALL_PREFIX=%s' % install_dir] + '-DCMAKE_INSTALL_PREFIX=%s' % install_dir, + '-DPYTHON_EXECUTABLE=%s' % sys.executable] if "CMAKE_ARGS" in os.environ: cmake_args += [ item for item in os.environ["CMAKE_ARGS"].split(" ") if item]