在 PyDev 中启动并调试单个脚本

发布于 2024-12-03 07:53:48 字数 569 浏览 0 评论 0原文

我是使用 Eclipse 和 PyDev (Aptana Studio 3) 的初学者。我不习惯也不理解像Eclipse这样大的IDE的工作流程。

我有一个简单的任务:我有一个简单的 Python 脚本,我想在 Eclipse 中打开并运行它,并在 Eclipse 控制台中输出它。或者调试一下。

到目前为止,我使用了另一个名为 Eric4 的 IDE,它允许我做我想做的事情 - 打开一个文件并立即运行,无需创建项目或设置启动配置。

这在 Eclipse 中可能吗,或者我必须为我想要运行或调试的每个文件创建一个项目?我想了解它是如何工作的。

我想我明白创建一个项目至少需要设置路径(PYTHONPATH),但如果它是单个脚本 - 默认情况下以某种方式使用当前目录?

例如,我有一个名为 snippets 的文件夹,其中保存了许多演示某些功能的 python 脚本。如何一一打开这些文件并运行它们?

我的大多数同事在单独的控制台中启动 python 脚本 - python my_scipt.py。

I am a beginner in using Eclipse and PyDev (Aptana Studio 3). I am not used to and i don't understand the workflow in such big IDEs as Eclipse.

I have a simple task: i have a simple Python script, which i want to open and run in Eclipse, having its output in Eclipse console. Or debug it.

Until now i used another IDE called Eric4, which allowed me to do what i want - open a file and run immediately, without creating a project or setting up launch configurations.

Is this possible in Eclipse, or i have to create a project for each file i want to run or debug? I want to understand how it works.

I guess i understand that creating a project is needed at least for settings up the paths (PYTHONPATH), but if it's a single script - somehow to use by default the current directory?

For example i have a folder called snippets where i keep a lot of python scripts which demonstrate some functionality. How do i open these files one by one and run them?

Most of my coworkers launch python scripts in a separate console - python my_scipt.py.

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

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

发布评论

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

评论(1

笑红尘 2024-12-10 07:53:48

您需要至少有一个项目具有您想要的配置(即:语法类型、解释器),然后,打开您要运行的文件并按 F9。

如果它是外部文件(即:不在 Eclipse 中的项目下的文件),它会要求您将项目与启动相关联以获取启动所需的信息,但该文件实际上不必这样做位于项目中(请注意,您可以将外部文件从文件系统拖到 Eclipse 中以打开它们)。

我建议您按照入门步骤操作:http://pydev.org/manual_101_root.html (它指导您配置 PyDev 并解释如何进行运行/调试会话)。

You need to have at least one project with the configuration you want (i.e.: syntax type, interpreter), then, open the file you want to run and press F9.

If it's an external file -- i.e.: a file that's not under a project in Eclipse -- it'll ask you to associate a project with the launch to get the needed information for the launch, but the file doesn't really have to be in the project (note that you can drag external files from your filesystem into Eclipse to open them).

I suggest you follow the steps on the getting started: http://pydev.org/manual_101_root.html (it guides you to configuring PyDev and explains how to do a run/debug session).

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