diff --git a/doc/Makefile b/doc/Makefile
index c3529688942efc29effcf7c574d861e211ff0c5c..28f86b153fab74b06e65fab437a639e557a48974 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -136,5 +136,5 @@ $(foreach name,$(SCRIPTS),$(eval $(call makedep,$(name))))
 
 # Generation of images
 .%_flag: %.py
-	cd $(dir $<) && python $(notdir $<)
+	cd $(dir $<) && python3 $(notdir $<)
 	@touch $@
diff --git a/setup.py b/setup.py
index 444fa71d82409d7b94ec85227f00ae09c5d118b2..9782a4842158064eb5f40bab4d2fac3614e2a16c 100755
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Copyright 2011-2015 Kwant authors.
 #