Pydev相对项目路径

发布于 2024-09-09 06:08:38 字数 148 浏览 4 评论 0原文

我用 pydev 插件安装了 eclipse。我需要在 eclipse 上运行我现有的项目。但我的代码中有文件的相对路径。我希望 Eclipse 将相对路径附加到项目的默认目录。相反,它将相对路径附加到 Eclipse 安装目录。我找不到解决问题的方法。

提前致谢。

I installed eclipse with pydev plugin. I need to run my existing project on eclipse. But there are relative paths to the files inside my code. I expect from eclipse to append relative paths to the project's default directory. Instead, it appends the relative path to the directory where Eclipse is installed. I could not find a way to solve the problem.

Thanks in advance.

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

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

发布评论

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

评论(3

小傻瓜 2024-09-16 06:08:38

我终于找到了如何做到这一点,并且正在为其他有同样问题的人写答案。您可以在运行配置或调试配置中找到它。从左侧选择“Python Run”和您的运行配置,然后在右侧的“参数”选项卡中,将“工作目录”设置为“其他”,并给出要运行代码的“路径”。感谢您的关注,韦恩顺便说一句。

I finally found out how to do it and I am writing the answer for other people with the same problem. You can find it in Run Configurations or Debug Configurations. Choose "Python Run" and your run configuration from the left and then in the "Arguments" tab in the right side, set your "working directory" as "other" with giving "the path" on which you want to run your code. Thanks for your interest, Wayne btw.

聆听风音 2024-09-16 06:08:38

看一下项目设置,我从未在 Eclipse 中使用过 Pydev,但您应该能够设置项目的执行位置或引用路径。

当然可能还有更好的解决方案,但希望对您有所帮助!

Take a look in the project settings, I've never used Pydev with Eclipse, but you should be able to set where the project is executed at, or paths for references.

Of course there may be a better solution, but hopefully that's some help!

旧情勿念 2024-09-16 06:08:38

另一种方法是从“运行配置”转到“环境”选项卡。添加一个名为“PATH”的新变量,并在“值”框中指定所需的目录。

Another way to do it is to go to the 'Environment' tab from the "Run Configuration". Add a new variable with name, "PATH", specifying your desired directory in the "Value" box.

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