Emacs支持IPython 24.x [英] IPython support on Emacs 24.x

查看:86
本文介绍了Emacs支持IPython 24.x的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对IPython与Emacs的集成感到困惑。从Emacs 24开始,Emacs拥有自己的 python.el 。请问这个文件有IPython的或只是Python支持?



此外,的 Emacswiki 谈到一个名为 IPython.el 的文件(尽管它提供的链接: http://ipython.scipy.org/dist/ipython.el 返回404错误)。这个文件是否与Emacs 24' python.el 兼容,或者只适用于 python-model.el

解决方案

在新的 python.el (随Emacs的版本24.3)不支持IPython。您需要将以下行添加到 init.el 文件(从 python.el 中复制的指令):

 (require'python)
(setq
python-shell-interpreteripython
python -shell-interpreter-args--pylab
python-shell-prompt-regexpIn \\ [[0-9] + \\]:
python-shell- prompt-output-regexpOut\\ [[0-9] + \\]:来自IPython.core.completerlib import的
python-shell-completion-setup-code
module_completion
蟒 - 壳完成模块串码
';' 加入(module_completion( '' '%s' 的 ''))\\\

python-。 shell-completion-string-code
';'。join(get_ipython()。Completer.all_completions('''%s'''))\\\

这适用于Linux(我正在运行Ubuntu 12.04),Windows可能需要一些其他的修改(有关详细信息,请查看 init.el source)。



但是,您应该使用 ipython.el (它与IPython包一起发布),因为它明确地取决于 python-mode.el (至少在我的系统上安装了IPython 0.12.1的情况)。


I am confused about the integration of IPython with Emacs. Starting with Emacs 24, Emacs ships with it's own python.el. Does this file have support for IPython or just for Python?

Also, the Emacswiki talks about a file called IPython.el (although the link it provides: http://ipython.scipy.org/dist/ipython.el returns a 404 Error). Is this file compatible with Emacs 24' python.el or does it only work with python-model.el?

解决方案

The new python.el (shipped with Emacs version 24.3) does support IPython. You need to add the following lines to your init.el file (instructions copied from python.el):

(require 'python)
(setq
  python-shell-interpreter "ipython"
  python-shell-interpreter-args "--pylab"
  python-shell-prompt-regexp "In \\[[0-9]+\\]: "
  python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
  python-shell-completion-setup-code
    "from IPython.core.completerlib import module_completion"
  python-shell-completion-module-string-code
    "';'.join(module_completion('''%s'''))\n"
  python-shell-completion-string-code
    "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")

This works on Linux (I'm running Ubuntu 12.04), some additional modifications might be needed on Windows (for details, check the init.el source).

However, you should not use ipython.el (which is distributed with the IPython package), as it explicitly depends on python-mode.el (at least this is the case with IPython 0.12.1 which is installed on my system).

这篇关于Emacs支持IPython 24.x的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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