How to set the default working directory for run configurations in PyCharm

故事扮演 提交于 2019-12-22 01:34:31

问题


When I want to run one of our many python scripts I hit run, which creates a new run configuration. The working directory for that configuration is the folder in which the python script file resides. Instead, it should run from a project wide fixed folder. I'd like to set that somehow but I really cannot figure out why, which is a bit odd as I'd expect many people to want to have this functionality. Do you know how to pull this off?


回答1:


If you hit the Edit configurations... button in the submenu appearing when clicking on your currently selected run configuration in the top right of PyCharm, you are able to edit the fields (and therefore also the working directory) of Python run configurations by selecting Python from the Templates (also called Defaults in versions pre-2018) and specifying the desired values.

Don't forget to hit Apply/OK before creating new run configurations, which should now contain the default values you specified!

As far as I know, these defaults are local to one project. See also: https://www.jetbrains.com/help/pycharm/2016.2/creating-and-editing-run-debug-configurations.html



来源:https://stackoverflow.com/questions/40088657/how-to-set-the-default-working-directory-for-run-configurations-in-pycharm

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