diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5bd4f14586a8c6ad0357b65c3cfeab861d066760..2a527dc6a19d49947a5b3097b4a41e88c5a18df3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,9 +87,11 @@ if (PYBIND)
 
     # Handles Python + pybind11 headers dependencies
     target_link_libraries(${module_name}
+        PRIVATE
+            Python::Python
         PUBLIC
             pybind11::pybind11
-        )
+    )
 endif()
 
 target_link_libraries(${module_name} PUBLIC Threads::Threads fmt::fmt)
diff --git a/setup.py b/setup.py
index 370f72a6e19c45dce9291ae9ff1c276bf9695ec5..e92cd901ae7a7296b01105060d6a3f7e0eb29a5e 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,6 @@ import os
 
 import shutil
 import pathlib
-import subprocess
 import multiprocessing
 
 from math import ceil
@@ -46,7 +45,8 @@ class CMakeBuild(build_ext):
 
         # Impose to use the executable of the python
         # used to launch setup.py to setup PythonInterp
-        param_py = "-DPYTHON_EXECUTABLE=" + sys.executable
+        python_executable = sys.executable
+        print(f"python executable {python_executable}")
 
         compile_type = "Debug"
         install_path = (
@@ -59,7 +59,7 @@ class CMakeBuild(build_ext):
             [
                 "cmake",
                 str(cwd),
-                param_py,
+                "-DPYTHON_EXECUTABLE="+python_executable,
                 "-DTEST=OFF",
                 f"-DCMAKE_INSTALL_PREFIX:PATH={install_path}",
                 f"-DCMAKE_BUILD_TYPE={compile_type}",