PyDev console working directory

谁说我不能喝 提交于 2020-01-13 18:04:58

问题


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().


回答1:


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.

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.

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.



来源:https://stackoverflow.com/questions/12343898/pydev-console-working-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!