--- a/src/api/python/CMakeLists.txt
+++ b/src/api/python/CMakeLists.txt
@@ -99,7 +99,7 @@
     message(STATUS "CMAKE_INSTALL_PYTHON_PKG_DIR not set. Trying to guess")
     execute_process(
       COMMAND "${Python3_EXECUTABLE}" "-c"
-        "import sysconfig; print(sysconfig.get_path('purelib'))"
+        "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(prefix=''))"
       RESULT_VARIABLE exit_code
       OUTPUT_VARIABLE CMAKE_INSTALL_PYTHON_PKG_DIR
       OUTPUT_STRIP_TRAILING_WHITESPACE
