diff --git a/paddle/extension.h b/paddle/extension.h index 2d38d51cd36e6d438c480c7325214e9aad3454ea..1a8243cb569816bf3a50d48a96cbab70b4fb05e0 100644 --- a/paddle/extension.h +++ b/paddle/extension.h @@ -16,7 +16,7 @@ limitations under the License. */ // All paddle apis in C++ frontend #include "paddle/phi/api/all.h" -// Python bindings for the C++ frontend -#ifndef PADDLE_ON_INFERENCE +// Python bindings for the C++ frontend (includes Python.h) +#if !defined(PADDLE_ON_INFERENCE) && !defined(PADDLE_NO_PYTHON) #include "paddle/utils/pybind.h" #endif