【问题标题】:Changing the "wdir" option in Spyder for Python更改 Spyder for Python 中的“wdir”选项
【发布时间】:2015-05-30 22:23:19
【问题描述】:

这个问题听起来和this one 很像,但又不一样。当我按F5 在 Spyder 中运行我的脚本时,控制台会显示如下一行:

runfile('C:/Users/usr/Documents/Python Scripts/BanditBook/algorithms/ucb/test_ucb1.py'
, wdir='C:/Users/usr/Documents/Python Scripts/BanditBook/algorithms/ucb')

我想将 wdir 参数更改为上两层,以便自动运行脚本 wdir = C:/Users/usr/Documents/Python Scripts/BanditBook。我怎样才能在 Spyder 中做到这一点?我正在运行 Python 2.7。

【问题讨论】:

    标签: python path


    【解决方案1】:

    CTRL+SHIFT+ALT+P然后就可以进入'Run ' 标签。然后在 '工作目录' 下选择 '以下目录' 框。输入:

    C:/Users/usr/Documents/Python Scripts/BanditBook 
    

    点击ApplyOK,它应该会从那个位置运行。如果您希望它恢复为其他脚本的方式,只需将其更改回'脚本目录',您应该一切顺利!

    如果您想每次都更改wdir,我建议您检查运行选项卡上的始终在第一个文件运行时显示运行设置对话框,以便需要时弹出。

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 2017-09-03
      • 1970-01-01
      • 2019-01-18
      • 2016-09-04
      • 2012-08-08
      • 2016-06-26
      • 2020-04-12
      • 2017-09-21
      相关资源
      最近更新 更多