Pydev相对项目路径
我用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我终于找到了如何做到这一点,并且正在为其他有同样问题的人写答案。您可以在运行配置或调试配置中找到它。从左侧选择“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.
看一下项目设置,我从未在 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!
另一种方法是从“运行配置”转到“环境”选项卡。添加一个名为“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.