How do I make Python3 the default Python in Geany

后端 未结 3 1827
盖世英雄少女心
盖世英雄少女心 2020-12-15 07:10

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

相关标签:
3条回答
  • 2020-12-15 07:11

    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.

    0 讨论(0)
  • 2020-12-15 07:31

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

    0 讨论(0)
  • 2020-12-15 07:37

    For Linux:
    Goto > Build > Set Build Commands In the Python Commands Edit the Command text box as:
    python3 -m py_compile "%f"
    In the Execute Commands Edit the Command as:
    python3 "%f"

    In the same way You can configure Geany for Python2 simply remove the '3' as: In the Python Commands Edit the Command text box as:
    python -m py_compile "%f"
    In the Execute Commands Edit the Command as:
    python "%f"

    You can also configure for specific python versions like Python3.7 simply replace the version number in the Set Build Commmands like: python3.7 -m py_compile "%f" in Commands and python3.7 "%f" in Execute

    For Windows:
    Goto > Build > Set Build Commands In the Python Commands Edit the Command text box as:
    python -m py_compile "%f"
    In the Execute Commands Edit the Command as(If you are using python3.7 and python is installed in C drive, otherwise browse to where Python is installed and replace it with the path, if path variable is not set):
    C:\Python37\python "%f"

    If you have python set in path variable, then this will work:
    python "%f"

    0 讨论(0)
提交回复
热议问题