PyDev控制台工作目录 [英] PyDev console working directory

查看:316
本文介绍了PyDev控制台工作目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我打开PyDev控制台时,当前的工作目录是我的Eclipse文件夹。如何将控制台配置为使用项目文件夹作为当前工作目录?这可以设置为工作区范围吗? 这个问题是相关的,但是这个目录是硬编码的,没有帮助。到目前为止,我发现Eclipse运行配置变量 $ {project_loc:/ selected project name} 不能与Python的 os.chdir )

When I open a PyDev console, the current working directory is my Eclipse folder. How can I configure the console to use the project folder as the current working directory? Can this be set workspace-wide? This question is related, but unhelpful as the directory is hard coded. So far, I've discovered that the Eclipse run configuration variable ${project_loc:/selected project name} cannot be used with Python's os.chdir().

推荐答案

如果你去Windows - >首选项 - > PyDev - > Interpreter,你可以在Eclipse下配置Python使用的PYTHONPATH变量,并添加所需的任何项目目录,以便在Eclipse中执行Python时可见。

If you go to Windows -> Preferences -> PyDev -> Interpreter, you can configure the PYTHONPATH variable used by Python under Eclipse, and add whatever project directories you want so that they are visible when executing Python inside of Eclipse.

我发现更容易在Eclipse之外执行我的代码,并为PYTHONPATH使用更好的系统工具。而对于这个问题,只需使用Emacs或VIM。

I find it easier to execute my code outside of Eclipse and use better system tools for the PYTHONPATH. And for that matter, just use Emacs or VIM.

但是,一般来说,您不想混淆描述工作空间目录的Eclipse设置。最好将项目代码位置附加到Eclipse / PyDev PYTHONPATH。

In general, though, you don't want to mess with the Eclipse settings that describe the workspace directory. It's better to just append project code locations to the Eclipse/PyDev PYTHONPATH.

这篇关于PyDev控制台工作目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆