ipython的历史文件在哪里 [英] Where is the history file for ipython

查看:64
本文介绍了ipython的历史文件在哪里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法确定ipython在何处存储其历史记录.

I can not determine where the ipython is storing its history.

a.没有〜/.pythonhistory:

a. There is no ~/.pythonhistory:

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

b. python启动文件中没什么特别的:

b. Nothing special in the python startup file:

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中有很多可用的历史记录.

c. BUT: i do have plenty of history available in ipython when I start it up.

那么历史记录存储在哪里?

So where is that history being stored?

UPDATE @Stefano的答案给出了正确的方法:这是实际路径

UPDATE the answer from @Stefano led the correct way: here is the actual path

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历史记录存储在配置文件目录中的SQLite数据库中.默认情况下:

IPython history is stored in a SQLite database located in the profile directory. By default:

~/.ipython/profile_default/history.sqlite

较早版本(1.x)至少在符合~/.config/ipython中>基于XDG的规范(即大多数Linux发行版).

Older versions (1.x) stored profile data in ~/.config/ipython, at least on platforms conforming to XDG basedir specs (i.e. most Linux distributions).

无论如何,您可以通过以下方式找到配置文件目录:

Anyway, you can locate the profile directory with:

$ ipython locate profile default

请注意,如果同时安装了IPython和IPython3,则历史数据库是共享的.

Notice that the history database is shared between IPython and IPython3, if both are installed.

这篇关于ipython的历史文件在哪里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆