diff --git a/Makefile.am b/Makefile.am
index 19f0a6c91eb4120803dd1e95d6eb14fdf911e0a2..94c6b2dce2d779c437b4d7f075c5cb20c178cc3b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,6 +66,12 @@ dist-hook:
 		fi \
 	done
 
+install-data-hook:
+	cd $(DESTDIR)$(pkgconfigdir) && $(LN_S) graph-tool-py${PYTHON_VERSION}.pc graph-tool-py.pc
+
+uninstall-hook:
+	cd $(DESTDIR)$(pkgconfigdir) && rm -f graph-tool-py.pc
+
 ##############
 # src/graph/ #
 ##############
diff --git a/doc/demos/cppextensions/Makefile b/doc/demos/cppextensions/Makefile
index fc52124861ccd184ff0fe5c131a954e6ae2fa89d..c3e3bee86baf128ea2dcae63f291c4c7c32cff6e 100644
--- a/doc/demos/cppextensions/Makefile
+++ b/doc/demos/cppextensions/Makefile
@@ -1,6 +1,5 @@
-PY3DOTVERSION=$(shell python -c "import sys; print(sys.version_info[0],sys.version_info[1],sep='.')")
 CXX=g++
-CXXFLAGS=-O3 -fopenmp -std=gnu++17 -Wall -fPIC `pkg-config --cflags --libs graph-tool-py$(PY3DOTVERSION)` -shared
+CXXFLAGS=-O3 -fopenmp -std=gnu++17 -Wall -fPIC `pkg-config --cflags --libs graph-tool-py` -shared
 ALL: libkcore.so
 
 libkcore.so: kcore.hh kcore.cc