Geany – Build commands

In geany, if you click build then execute. By default, this executes your program in python2. I have by chance found a way to do either python 2 or 3.

I think you should still use

#!/usr/bin/env python
#!/usr/bin/env python3

at the top of your code,  as it then makes it clear to others and the normal python interpreter what to use.

You can create a new command under build to execute under python3



You can see I have added under execute command py3 execute then added an explicit command for python3.

Note for pi users : if your program uses the gpio you need to run programs in python as root with

sudo python

where is your program name

You should be able to do the same in geany by adding sudo to the execute box so it reads

sudo python “%f”


Hope this helps,  as always you can e-mail or tweet me,  offers of paid work at Torbay schools welcome.