在尝试自己回答这个问题时,我偶然发现了这个问题以及这个问题,并发现确实没有为 OP 提供完整的 TL;DR 信息的片段。
因此,为了我自己的记录并让这里的 SO 答案更完整,我提供了一个快速实现并选中“增加 iPython 历史长度”。
生成iPython
配置文件
$ ipython profile create <profile name>
我只是想要这个作为我的默认配置,所以我跑了:
$ ipython profile create
修改ipython_config.py
文件
运行上述命令会创建一个ipython_config.py
文件,该文件(on*.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