diff --git a/runtime/pgAdmin4.pro b/runtime/pgAdmin4.pro
index fd3985c..0393600 100644
--- a/runtime/pgAdmin4.pro
+++ b/runtime/pgAdmin4.pro
@@ -56,13 +56,18 @@ else {
             error(The python-config executable could not be found. Ensure Python is installed and in the system path.)
         } else {
 	    PYTHON_CONFIG=python-config
-	    DEFINES += PYTHON2
         }
     }
 
     QMAKE_CXXFLAGS += $$system($$PYTHON_CONFIG --includes)
     QMAKE_LFLAGS += $$system($$PYTHON_CONFIG --ldflags)
     LIBS += $$system($$PYTHON_CONFIG --libs)
+    contains( LIBS, lpython2 ) {
+	    DEFINES += PYTHON2
+            message(Python2 detected.)
+	    } else {
+            message(Python3 detected.)
+            }
 }
 
 # Source code
