如何配置 Geany 来编译和运行我的 Python 程序?
在“构建”菜单下,我可以看到“执行”选项,但它是灰色的。
唯一可用的选项是“设置包含和参数”。当我单击时,两个字段都已填写。我必须在那里写什么?
Under the Build menu, I can see 'Execute' option, but it is greyed out.
The only option available is 'Set Includes and Arguments'. When I click that both fields are already filled out. What do I have to write there?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我不需要在 Geany 中配置任何内容。我只需点击 F5 即可执行当前模块。
您确定您的文件被识别为 Python 源文件吗?您使用的是哪个版本的 Geany(我使用的是 SVN 版本,非常稳定;该死,它非常稳定;-))?我的版本中有一个稍微更完善的 Python 编译配置,但命令是相同的,并且运行得很好。
I don't need to configure anything in Geany. I just hit F5 and the current module is executed.
Are you sure that your file is recognized as a Python source file? Which version of Geany are you using (I am using the SVN version, which is pretty stable; damn, it's rock solid stable ;-))? I have a slightly more developed configuration for Python compilation in my version, but the commands are the same and it works very well.
我遇到了同样的问题,并找到了以下解决方案:
在“构建选项”对话框中,单击对话框底部的“_执行”,_执行选项变为可编辑。
我将 Python 安装的完整路径名放在那里 (C:\Python27\python %F) 或 (C:\Python32\python %F),它似乎工作得很好。
I had the same problem and found the following solution:
In the 'Build Options' dialogue, click on '_Execute' at the bottom of the dialogue and the _execute options become editable.
I put the full path name to my Python install in there (C:\Python27\python %F) or (C:\Python32\python %F) and it seems to work just fine.
由于某种未知原因,新安装的 Geany 在 Ubuntu 19.04 ( Disco Dingo)在构建→设置构建命令→执行默认设置中有python“%f”。
我用 python3 "%f" 解决了类似的问题。
For some unknown reason a new installed Geany at Ubuntu 19.04 (Disco Dingo) had python "%f" at Build → Set Build Commands → Execute default settings.
I solved a similar issue with python3 "%f" instead.
另外,不要忘记设置“KeyBinding”,即您按下以激活“运行、执行、编译、保存”的键盘快捷键(单个或组合) 、查找、打印等...
这样做;
菜单编辑 → 首选项 → 键盘快捷键。
在这里您可以选择/更改任何键以映射到您想要的任何操作。
为什么?因为其他一些 Linux 程序可能已被覆盖,或者可能已采用默认的 Geany 分配的映射键。
Also don’t forget to set the “KeyBinding”, i.e., the keyboard shortcut-key (single or combination) you press to activate “Run, Execute, Compile, Save, Find, Print, etc...
To do so;
Menu Edit → Preferences → Keyboard Shortcuts.
Here you can choose/change any Key/s to map to any action you want.
Why? Because some other Linux program might have been overridden, or might have taken the default Geany assigned map keys.
您需要在一开始就设置路径变量。或者您需要在构建→设置构建命令中设置变量。
此视频可以让您清楚地了解:
Install Geany for Python
您的编译路径看起来不错。但在执行路径中,给出 python.exe 的完整路径。就我而言,它是...
C:\python27\python "%f"
You need to set the path variables in the beginning. Or you need to set the variables in Build → set build commands.
This video can give you good clarity:
Install Geany for Python
Your compile path is looking fine. But in the execution path, give the full path of your python.exe. In my case it is...
C:\python27\python "%f"
查找 Python 控制台路径。
现在设置环境变量
Find the Python console path.
Now set the environment variable