[英]Increase IPython history length
:我曾嘗試下面這個帖子增加IPython的歷史長度IPython的歷史長度控制 ,通過改變c.TerminalInteractiveShell.history_length
在~/.ipython/profile_default/ipython_config.py
。
配置文件似乎是在啟動時執行的(如果我在文件中放置print('test-startup')
,它在我啟動IPython時打印)
但它似乎沒有任何影響,無論如何都要檢查ipython中的歷史大小(有點像你怎么做echo $HISTSIZE; echo $HISTFILESIZE
在bash中echo $HISTSIZE; echo $HISTFILESIZE
?)
運用
In[3]: %config TerminalInteractiveShell.history_length
Out[3]: 10000
在試圖回答這個問題我自己,我就這個問題絆倒,以及這個問題 ,發現片段真的沒有提供OP與完整,TL; DR信息。
因此,對於我自己的記錄並在SO上做出更完整的答案,我提供了一個快速實現並檢查“增加iPython歷史記錄長度”。
iPython
配置文件 $ ipython profile create <profile name>
我只想把它作為我的默認配置,所以我跑了:
$ ipython profile create
ipython_config.py
文件 運行上面的命令會創建一個ipython_config.py
文件,該文件位於~/.ipython/profile_default/ipython_config.py
上。 *.nix
~/.ipython/profile_default/ipython_config.py
這些是我取消注釋並更改以下值的兩行:
啟動iPython並運行上面接受的答案中找到的命令,以確保我們的新history_length = 100,000
。
benjamingross (develop*)$ ipython
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:14:23)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.3.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: %config TerminalInteractiveShell.history_length
Out[1]: 100000
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.