diff --git a/cmake/python.cmake b/cmake/python.cmake index 8d65c62409..ae279a0824 100644 --- a/cmake/python.cmake +++ b/cmake/python.cmake @@ -290,7 +290,7 @@ if(BUILD_TESTING) add_custom_command(TARGET python_package POST_BUILD # Clean previous install otherwise pip install may do nothing COMMAND ${CMAKE_COMMAND} -E remove_directory ${VENV_DIR} - COMMAND ${VENV_EXECUTABLE} -p ${Python3_EXECUTABLE} ${VENV_DIR} + COMMAND ${VENV_EXECUTABLE} -p ${Python3_EXECUTABLE} --system-site-packages ${VENV_DIR} #COMMAND ${VENV_EXECUTABLE} ${VENV_DIR} # Must NOT call it in a folder containing the setup.py otherwise pip call it # (i.e. "python setup.py bdist") while we want to consume the wheel package diff --git a/makefiles/Makefile.python.mk b/makefiles/Makefile.python.mk index 621e5efeb4..28a3867b88 100644 --- a/makefiles/Makefile.python.mk +++ b/makefiles/Makefile.python.mk @@ -1038,7 +1038,7 @@ endif .PHONY: test_package_python # Test Python "ortools" wheel package test_package_python: package_python -$(DELREC) $(PYPI_ARCHIVE_TEMP_DIR)$Svenv - $(PYTHON_EXECUTABLE) -m venv $(PYPI_ARCHIVE_TEMP_DIR)$Svenv + $(PYTHON_EXECUTABLE) -m venv --system-site-packages $(PYPI_ARCHIVE_TEMP_DIR)$Svenv $(COPY) test.py.in $(PYPI_ARCHIVE_TEMP_DIR)$Svenv$Stest.py $(COPY) ortools$Salgorithms$Ssamples$Ssimple_knapsack_program.py $(PYPI_ARCHIVE_TEMP_DIR)$Svenv $(COPY) ortools$Sgraph$Ssamples$Ssimple_max_flow_program.py $(PYPI_ARCHIVE_TEMP_DIR)$Svenv