diff --git a/.gitignore b/.gitignore index fcf982c8df..fc09c23fb8 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,6 @@ keys/ # metadata _emscripten_sdk/ + +# virtual Python environment +.venv diff --git a/Makefile b/Makefile index 6038d225ea..066a36a0f4 100644 --- a/Makefile +++ b/Makefile @@ -162,6 +162,12 @@ else endif +# Prefer the interpreter from an active Python virtual environment. +# Otherwise leave PYTHON_EXECUTABLE unset and let CMake resolve Python. +ifneq ($(strip $(VIRTUAL_ENV)),) + PYTHON_EXECUTABLE ?= $(VIRTUAL_ENV)/bin/python +endif + # Pick up specific Python path if set ifdef PYTHON_EXECUTABLE override CMAKE_ARGS += -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}