How do I make Python3 the default Python in Geany

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 03:16:26

问题


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.


回答1:


First at all: Don't change the global configuration for something like this, as this will change default behaviour for all system users and might lead into confusion.

The changes inside file /usr/share/geany/filetypes.python will be overwritten in changes done inside your home on ~/.config/geany/filedefs/filetypes.python.

When using the menu Build->Set Build Commands it will be saved also there. In fact, there is no need to update the file manually, but via the menu. This will also have the advantage, changes will be visible without restarting Geany.




回答2:


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 "%...



来源:https://stackoverflow.com/questions/29105941/how-do-i-make-python3-the-default-python-in-geany

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!