首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何永远保存ipython别名?

问如何永远保存ipython别名?
EN

Stack Overflow用户
提问于 2017-05-27 03:12:46
回答 2查看 571关注 0票数 1

我对如何保存ipython别名感到有点困惑,因此每次我打开ipython会话(首先保存别名之后)并直接使用别名命令(此时,不应该再次输入别名)。例如,在linux(或windows)中使用ipython时,我会使用vi而不是!vi文件。

vi fileneme

!vi filename

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-05-27 03:21:21

若要在ipython_config.py目录下的IPython目录中生成默认配置文件,请执行以下操作:

代码语言:javascript
复制
$ ipython profile create

在linux/windows中找到ipython_config.py

代码语言:javascript
复制
#use find command in linux
find / -name ipython_config.py
#in window,you can use all kinds of tools to search .
#in commands line,you can use 
ipython locate profile.
#in the directory,you can get it

编辑ipython_config.py文件以添加研究内容

代码语言:javascript
复制
c = get_config()
c.TerminalIPythonApp.display_banner = True
c.InteractiveShellApp.log_level = 20
c.InteractiveShellApp.extensions = []
c.InteractiveShellApp.exec_lines = []
c.InteractiveShellApp.exec_files = ['mycode.py']#load Module when open ipython
c.InteractiveShell.autoindent = True
c.InteractiveShell.colors = 'LightBG'#ipython console color
c.InteractiveShell.confirm_exit = False
c.InteractiveShell.editor = 'vim'#you can change your favorite editor
c.InteractiveShell.xmode = 'Context'
c.PrefilterManager.multi_line_specials = True
#you can add your alias in the fellowing list
c.AliasManager.user_aliases = [('vi','vim'),('py','python'),('git','git'),]#i add git ,vim python .i really dislike "!"

保存文件并退出并获取它

票数 2
EN

Stack Overflow用户

发布于 2018-10-10 16:36:34

thx@jack yang

  1. emacs ~/.ipython/profile_default/python_config.py

2.最后把c.AliasManager.user_aliases = [('e', 'emacsclient -t')]压下来。

3.退出并重新启动ipython

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44212569

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档