在这篇文章之后,我尝试增加IPython的历史长度:
Control ipython history length通过在~/.ipython/profile_default/ipython_config.py
中更改c.TerminalInteractiveShell.history_length
。在
配置文件似乎是在启动时执行的(如果我把print('test-startup')
放在文件中,它会在我启动IPython时打印出来)
但是它似乎没有任何影响,有没有从ipython内部检查历史大小(有点像在bash中如何做echo $HISTSIZE; echo $HISTFILESIZE
)在
使用
在试图自己回答这个问题时,我无意中发现了这个问题as well this question并找到了一些片段,这些片段确实没有向OP提供完整的TL;DR信息。在
因此,对于我自己的记录,为了让这里的答案更完整,我提供了一个快速实现和检查“增加iPython历史长度”
生成
iPython
配置文件我只想把它作为我的默认配置,所以我运行:
^{pr2}$修改
ipython_config.py
文件运行上述命令将创建一个
ipython_config.py
文件,该文件(在*.nix
上)存储在~/.ipython/profile_default/ipython_config.py
以下是我取消注释并更改值的两行:
检查以确保实施有效
启动iPython并运行上面接受的答案中的命令,以确保我们的新
history_length = 100,000
。在相关问题 更多 >
编程相关推荐