簡體   English   中英

ipython的歷史文件在哪里

[英]Where is the history file for ipython

我無法確定ipython存儲歷史的位置。

一種。 沒有〜/ .pythonhistory:

12:49:00/dashboards $ll ~/.py*
ls: /Users/steve/.py*: No such file or directory

python啟動文件中沒什么特別之處:

12:49:07/dashboards $echo $PYTHONSTARTUP
/shared/.pythonstartup
12:49:43/dashboards $cat /shared/.pythonstartup
import rlcompleter
import readline

readline.parse_and_bind("tab: complete")

C。 但是:當我啟動ipython時,我確實有很多歷史可用。

那么歷史存儲在哪里?

更新 @Stefano的答案導致了正確的方法:這是實際路徑

13:30:05/shared $ll ~/.ipython/profile_default/history.sqlite
-rw-r--r--  1 steve  staff  372736 Jun  3 12:48 /Users/steve/.ipython/profile_default/history.sqlite

如果您希望將IPython歷史記錄保存在純文本文件中,則可以自行導出。

%history -g -f filename 

IPython歷史記錄存儲在位於配置文件目錄中的SQLite數據庫中。 默認:

~/.ipython/profile_default/history.sqlite

舊版本(1.x)在~/.config/ipython存儲了配置文件數據,至少在符合基於XDG的規范 (即大多數Linux發行版)的平台上。

無論如何,您可以找到配置文件目錄:

$ ipython locate profile default

請注意,歷史數據庫在IPython和IPython3之間共享(如果兩者都已安裝)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM