如何使 Python3 成为 Geany 中的默认 Python [英] How do I make Python3 the default Python in Geany

查看:44
本文介绍了如何使 Python3 成为 Geany 中的默认 Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试修改 Geany 中默认的 Python 编译器/运行命令.

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

一些搜索表明我需要修改`/usr/share/geany/filetypes.python的最后两行如下

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"

然而,在重新启动 Geany 后,Build ->Set Build Commands 仍然显示旧命令并且尝试运行 py3 脚本会导致错误.

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

推荐答案

首先:不要更改此类的全局配置,因为这将更改所有系统用户的默认行为并可能导致混淆.

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.

/usr/share/geany/filetypes.python 文件中的更改将被您家中 ~/.config/geany/filedefs/filetypes.python.

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

当使用菜单Build->Set Build Commands 时,它也会被保存在那里.事实上,不需要手动更新文件,而是通过菜单.这也有好处,无需重新启动 Geany 即可看到更改.

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.

这篇关于如何使 Python3 成为 Geany 中的默认 Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆