diff --git a/pkgs/development/python-modules/recursive-pth-loader/default.nix b/pkgs/development/python-modules/recursive-pth-loader/default.nix
index e281d69c98ae..9a17e722679f 100644
--- a/pkgs/development/python-modules/recursive-pth-loader/default.nix
+++ b/pkgs/development/python-modules/recursive-pth-loader/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
 
   patchPhase = "cat ${./sitecustomize.py} > sitecustomize.py";
 
-  buildPhase = "python -m compileall .";
+  buildPhase = "${python}/bin/${python.executable} -m compileall .";
 
   installPhase =
     ''