--- common/test/CMakeLists.txt.orig
+++ common/test/CMakeLists.txt
@@ -356,14 +356,3 @@ if( PYTHON_EXECUTABLE )
     build_test( test_cpp11_traits_cxx )
     #--------------------------------------------------------------------
 endif( PYTHON_EXECUTABLE )
-#========================================================================
-# Installation of files
-#========================================================================
-if( NOT PYTHON_MODULE_INSTALL_DIR )
-    #set( PYTHON_MODULE_INSTALL_DIR ${SHARE_INSTALL_DIR}/nds2-client/python CACHE PATH "Installation directory for Python modules" )
-    set( PYTHON_MODULE_INSTALL_DIR ${pythondir_full} CACHE PATH "Installation directory for Python modules" )
-endif( NOT PYTHON_MODULE_INSTALL_DIR )
-if( NOT PYTHON_EXTMODULE_INSTALL_DIR )
-    #set( PYTHON_EXTMODULE_INSTALL_DIR ${LIBEXEC_INSTALL_DIR}/nds2-client/python CACHE PATH "Installation directory for Python extension modules" )
-    set( PYTHON_EXTMODULE_INSTALL_DIR ${pyexecdir_full} CACHE PATH "Installation directory for Python extension modules" )
-endif( NOT PYTHON_EXTMODULE_INSTALL_DIR )
--- config/cmake/Modules/Autotools/Archive/cx_python.cmake.orig
+++ config/cmake/Modules/Autotools/Archive/cx_python.cmake
@@ -117,16 +117,16 @@ function( cx_python )
       )
     set( pyexecdir_full ${pyexecdir_full} PARENT_SCOPE )
   endif ( )
-  if( NOT PYTHON_MODULE_INSTALL_DIR )
-    set( PYTHON_MODULE_INSTALL_DIR ${pythondir_full}
+  if( NOT PYTHON${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_MODULE_INSTALL_DIR )
+    set( PYTHON${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_MODULE_INSTALL_DIR ${pythondir_full}
       CACHE PATH "Installation directory for Python modules" )
     # cm_msg_debug_variable(PYTHON_MODULE_INSTALL_DIR)
-  endif( NOT PYTHON_MODULE_INSTALL_DIR )
-  if( NOT PYTHON_EXTMODULE_INSTALL_DIR )
-    set( PYTHON_EXTMODULE_INSTALL_DIR ${pyexecdir_full}
+  endif( )
+  if( NOT PYTHON${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_EXTMODULE_INSTALL_DIR )
+    set( PYTHON${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}_EXTMODULE_INSTALL_DIR ${pyexecdir_full}
       CACHE PATH "Installation directory for Python extension modules" )
     # cm_msg_debug_variable(PYTHON_EXTMODULE_INSTALL_DIR)
-  endif( NOT PYTHON_EXTMODULE_INSTALL_DIR )
+  endif( )
 
   cm_msg_debug_variable( PYTHON_EXECUTABLE )
   cm_msg_debug_variable( PYTHON_LIBRARIES )
--- config/cmake/Portfile.in.orig
+++ config/cmake/Portfile.in
@@ -157,8 +157,8 @@ foreach v {27 34 35 36} {
         "3*" -
         default { configure.args-replace -DENABLE_SWIG_PYTHON3=no "-DENABLE_SWIG_PYTHON3=yes -DPYTHON3_VERSION=${python.branch}" }
     }
-    configure.args-append     -DPYTHON_MODULE_INSTALL_DIR="${python.site_packages}" \
-                              -DPYTHON_EXTMODULE_INSTALL_DIR="${python.site_packages}" \
+      configure.args-append   -DPYTHON${python.version}_MODULE_INSTALL_DIR="${python.site_packages}" \
+                              -DPYTHON${python.version}_EXTMODULE_INSTALL_DIR="${python.site_packages}" \
                               -DSWIG_CPPFLAGS="-I${python.prefix}/include"
 
     destroot.target           install
--- python/module/nds2-client-python.cfg.in.orig
+++ python/module/nds2-client-python.cfg.in
@@ -1,2 +1,2 @@
-py@NDS_PYTHON_VERSION_MAJOR@@NDS_PYTHON_VERSION_MINOR@dir:Python sources:@pythondir_full@
-py@NDS_PYTHON_VERSION_MAJOR@@NDS_PYTHON_VERSION_MINOR@execdir:Python executable libraries:@pyexecdir_full@
+py@NDS_PYTHON_VERSION_MAJOR@@NDS_PYTHON_VERSION_MINOR@dir:Python sources:@PYTHON_MODULE_INSTALL_DIR@
+py@NDS_PYTHON_VERSION_MAJOR@@NDS_PYTHON_VERSION_MINOR@execdir:Python executable libraries:@PYTHON_EXTMODULE_INSTALL_DIR@
--- python/python2/CMakeLists.txt.orig
+++ python/python2/CMakeLists.txt
@@ -41,14 +41,17 @@ if ( NOT DEFINED ENABLE_SWIG_PYTHON2 OR ENABLE_SWIG_PYTHON2 )
       set(INTERFACE_FILE "${PROJECT_SOURCE_DIR}/python/module/nds_python.i")
 
 
+      set( NDS_PYTHON_VERSION_MAJOR ${PYTHON2_VERSION_MAJOR} )
+      set( NDS_PYTHON_VERSION_MINOR ${PYTHON2_VERSION_MINOR} )
+      set( PYTHON_MODULE_INSTALL_DIR ${PYTHON${PYTHON2_VERSION_MAJOR}${PYTHON2_VERSION_MINOR}_MODULE_INSTALL_DIR} )
+      set( PYTHON_EXTMODULE_INSTALL_DIR ${PYTHON${PYTHON2_VERSION_MAJOR}${PYTHON2_VERSION_MINOR}_EXTMODULE_INSTALL_DIR} )
+
       cx_swig_python_module(
           PREFIX         PYTHON2
           INTERFACE_FILE ${INTERFACE_FILE}
           MODULE         nds2
           LINK_LIBRARIES nds::cxx
           )
-      set( NDS_PYTHON_VERSION_MAJOR ${PYTHON2_VERSION_MAJOR} )
-      set( NDS_PYTHON_VERSION_MINOR ${PYTHON2_VERSION_MINOR} )
 
       #======================================================================
       # Configuration file rules
--- python/python3/CMakeLists.txt.orig
+++ python/python3/CMakeLists.txt
@@ -42,6 +42,11 @@ if ( NOT DEFINED ENABLE_SWIG_PYTHON3 OR ENABLE_SWIG_PYTHON3 )
       set(INTERFACE_FILE "${PROJECT_SOURCE_DIR}/python/module/nds_python.i")
 
 
+      set( NDS_PYTHON_VERSION_MAJOR ${PYTHON3_VERSION_MAJOR} )
+      set( NDS_PYTHON_VERSION_MINOR ${PYTHON3_VERSION_MINOR} )
+      set( PYTHON_MODULE_INSTALL_DIR ${PYTHON${PYTHON3_VERSION_MAJOR}${PYTHON3_VERSION_MINOR}_MODULE_INSTALL_DIR} )
+      set( PYTHON_EXTMODULE_INSTALL_DIR ${PYTHON${PYTHON3_VERSION_MAJOR}${PYTHON3_VERSION_MINOR}_EXTMODULE_INSTALL_DIR} )
+
       cx_swig_python_module(
           PREFIX         PYTHON3
           INTERFACE_FILE ${INTERFACE_FILE}
@@ -50,6 +55,8 @@ if ( NOT DEFINED ENABLE_SWIG_PYTHON3 OR ENABLE_SWIG_PYTHON3 )
           )
       set( NDS_PYTHON_VERSION_MAJOR ${PYTHON3_VERSION_MAJOR} )
       set( NDS_PYTHON_VERSION_MINOR ${PYTHON3_VERSION_MINOR} )
+      set( PYTHON_MODULE_INSTALL_DIR ${PYTHON${PYTHON3_VERSION_MAJOR}${PYTHON3_VERSION_MINOR}_MODULE_INSTALL_DIR} )
+      set( PYTHON_EXTMODULE_INSTALL_DIR ${PYTHON${PYTHON3_VERSION_MAJOR}${PYTHON3_VERSION_MINOR}_EXTMODULE_INSTALL_DIR} )
 
       #======================================================================
       # Configuration file rules