设置iPython默认配置文件 [英] Setting iPython default profile

查看:241
本文介绍了设置iPython默认配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装IPython之后,我创建了一个默认配置文件,其中包含:

Right after installing IPython, I created a default profile with:

$ ipython profile create

然后,我创建了另一个,这次我给它起了名字测试

Then, I created another one, this time I gave it the name testing:

$ ipython profile create testing

我已经根据自己的喜好定制了这个测试配置文件(提示符和自动重载扩展等),现在我希望它是我的默认配置文件,所以当我输入时它就开始了:

I have customized this testing profile (the prompt, and autoreload extension, etc) to my liking, and now I would like it to be my default profile, so it's started when I type:

$ ipython

我知道我可以用以下内容开始:

I know that I can start it with:

$ ipython --profile=testing

但这是很多打字。

我已经尝试在 profile_default中编辑文件 ipython_config.py 文件夹,第89行

# The IPython profile to use.
c.TerminalIPythonApp.profile = 'testing'

但它不起作用。有什么想法吗?它坏了吗?

But it's not working. Any ideas why? Is it broken?

编辑:由于我必须在几周或四十五小时的时间段内使用不同的配置文件,我正在寻找一种选择默认配置文件的方法那些时间段。从 IPython 本身实现这一目标真是太棒了,与此同时,一个非常方便的解决方法是在bash配置中添加别名(正如其中一个中的 cel 所指出的那样)评论):

Since I have to use different profiles for periods of time of weeks or fortnights, I'm looking for a way of selecting a default profile for those periods of time. It would be awesome achieving that from IPython itself, in the meantime, a very convenient workaround is adding an alias in the bash configuration(as pointed out by cel in one of the comments):

alias ipython='ipython --profile=testing'


推荐答案

备份 profile_default 然后重命名 profile_testing profile_default

或者您可以将 profile_testing 的内容复制到 profile_default

Or you can copy the contents of profile_testing to profile_default.

这篇关于设置iPython默认配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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