--- python/CMakeLists.txt.orig	2023-06-21 23:35:33.000000000 +0200
+++ python/CMakeLists.txt	2023-07-31 15:18:23.000000000 +0200
@@ -2,7 +2,7 @@
 # For find_package (Python)
 cmake_minimum_required(VERSION 3.12)
 
-find_package (Python COMPONENTS Interpreter Development)
+find_package (Python __PYVER__ EXACT COMPONENTS Interpreter Development)
 if(NOT Python_FOUND)
     message(FATAL_ERROR "Could not find Python. Set RSGIS_PYTHON=OFF to disable.")
 endif(NOT Python_FOUND)
@@ -12,14 +12,14 @@
 endif(APPLE)
 
 #set(PYRSGIS_ROOT_PATH "${Python_SITELIB}")
-file(TO_CMAKE_PATH "${Python_SITELIB}" PYRSGIS_ROOT_PATH)
-if(NOT MSVC AND NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
-    # user has set CMAKE_INSTALL_PREFIX - ensure we install
-    # under there rather than the default Python install location.
-    # BUT we want to keep the last part of the path the same as Python_SITELIB
-    # (ie the lib/pythonX.X/site-packages part)
-    string(REPLACE "${_Python_PREFIX}" "${CMAKE_INSTALL_PREFIX}" PYRSGIS_ROOT_PATH "${PYRSGIS_ROOT_PATH}")
-endif(NOT MSVC AND NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+file(TO_CMAKE_PATH "${Python3_SITELIB}" PYRSGIS_ROOT_PATH)
+# if(NOT MSVC AND NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+#     # user has set CMAKE_INSTALL_PREFIX - ensure we install
+#     # under there rather than the default Python install location.
+#     # BUT we want to keep the last part of the path the same as Python_SITELIB
+#     # (ie the lib/pythonX.X/site-packages part)
+#     string(REPLACE "${_Python_PREFIX}" "${CMAKE_INSTALL_PREFIX}" PYRSGIS_ROOT_PATH "${PYRSGIS_ROOT_PATH}")
+# endif(NOT MSVC AND NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
 message(STATUS "installing Python libs to ${PYRSGIS_ROOT_PATH}")
 
 #set(PYRSGIS_INSTALL_PATH "${PYRSGIS_ROOT_PATH}/rsgislib")
@@ -231,5 +231,5 @@
 install(TARGETS _specunmixing DESTINATION "${PYRSGIS_INSTALL_PATH}/imagecalc/specunmixing")
 
 # custom install step to create .pyc files
-install(CODE "execute_process(COMMAND ${Python_EXECUTABLE} -m compileall ${PYRSGIS_INSTALL_PATH})")
+#install(CODE "execute_process(COMMAND ${Python_EXECUTABLE} -m compileall ${PYRSGIS_INSTALL_PATH})")
 
