How do I make Python3 the default Python in Geany

user3817250 picture user3817250 · Mar 17, 2015 · Viewed 32.5k times · Source

I've been trying to modify the default Python compiler/run command in Geany.

Some searching indicated that I would need to modify `/usr/share/geany/filetypes.python's last two lines as follows

#compiler=python -m py_compile "%f"
#run_cmd=python "%f"
compiler=python3 -c "import py_compile; py_compile.compile('%f')"
run_cmd=python3 "%f"

After restarting Geany however, Build -> Set Build Commands still shows the old commands and attemping to run a py3 script causes errors.

Answer

suspicious_williams picture suspicious_williams · Dec 16, 2015

Add '3' to the end of "python" on the Build->Set Build Commands menu, as mentioned above.

Under Python commands, you should see:

  1. Compile python -m py_compile "%...

Add '3' to the end of python here

  1. Compile python3 -m py_compile "%...

enter image description here