在 Aptana 中配置 Python 以将输出推送到控制台窗口

发布于 2025-01-03 22:35:15 字数 478 浏览 3 评论 0原文

我最近在学习python。我一直在使用 pyscripter,如 kahnacademy 上演示的那样,但在发现 pyscripter 中的一些错误后,决定升级到更强大的编码环境,因此选择了 aptana studio。

现在我已经正确安装了 python,它将运行脚本,但我似乎无法弄清楚如何让它将打印命令输出到底部的控制台窗口。

为了测试这个,我的脚本很简单:

print "hello"

控制台给我:

Finding files... done.
Importing test modules ... done.

---------------------------------
Ran 0 tests in 0.000s

OK

我知道我在这里缺少一些非常简单的东西,但我不知道它可能是什么。
我只想查看 python 控制台输出 - 我可能会错过什么?

I have very recently been learning python. I have been using pyscripter as is demonstrated over on kahnacademy, but after finding some bugs in pyscripter decided to upgrade to a much more robust coding environ, hence aptana studio.

Right now I have python installed properly, it will run scripts, but I cannot seem to figure out how to get it to output print commands to the console window at the bottom.

To test this my script is simply:

print "hello"

The console gives me:

Finding files... done.
Importing test modules ... done.

---------------------------------
Ran 0 tests in 0.000s

OK

I know I am missing something really simple here but I haven't the foggiest what it could be.
I would like to see the python console output only - what could I be missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦归所梦 2025-01-10 22:35:16

Aptana 使用 PyDev。
要在调试模式下运行模块 (.py) 文件,您需要告诉该文件您要执行什么函数。测试时尝试这个模板:

def main():
    print "Hello world"

if __name__ == "__main__":
    main()        

Aptana uses PyDev.
To run modules (.py) files in debug mode you need to tell the file what function you want to execute. Try this template when testing:

def main():
    print "Hello world"

if __name__ == "__main__":
    main()        
滥情稳全场 2025-01-10 22:35:15

您可能正在使用“运行单元测试”启动而不是常规启动。对于常规启动,只需在您正在编辑的文件上按 F9 即可运行。另外,如果您还没有,请阅读 PyDev 入门指南: http://pydev.org/manual_101_root.html (或至少 http://pydev.org/manual_101_run.html,这是与您的问题相关的部分,它还将解释如何配置 Ctrl+F11 重新启动上次启动等)。

You're probably using the 'run unit-tests' launch instead of the regular launch. For a regular launch, just press F9 on the file you're editing and it should work. Also, if you still haven't, read the PyDev getting started guide: http://pydev.org/manual_101_root.html (or at least http://pydev.org/manual_101_run.html, which is the part related to your problem, and it'll also explain how to config Ctrl+F11 to relaunch your last launch, etc).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文