简体   繁体   English

在emacs中启动时,ipython中没有提示

[英]No prompt in ipython when launched in emacs

I tried to launch ipython console on emacs by typing Cc Cp while editing a python script. 我试图在编辑python脚本时通过键入Cc Cp在emacs上启动ipython控制台。 But the ipython console looks blank. 但是ipython控制台看起来空白。 Although when I type some command there is an output and the Out prompt is displayed. 尽管当我键入一些命令时,会有一个输出并显示出Out提示。 Furthermore when I exit(), many In() prompt are displayed. 此外,当我退出()时,会显示许多In()提示。 Why is this the case? 为什么会这样呢?

IPython控制台退出

I am using emacs versiion 24.3, ipython 2.1.0 and python 2.7.6. 我正在使用emacs versiion 24.3,ipython 2.1.0和python 2.7.6。 Following is my init.el 以下是我的init.el

;;; To start emacs maximized at startup
(w32-send-sys-command 61488)


;;; To remove the toolbar from emacs
(tool-bar-mode 0)


;;; IDO configuration
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)


;;; Add MELPA repository
(require 'package)
(package-initialize)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)


;;; Configure Aspell
(add-to-list 'exec-path "C:/Program Files (x86)/Aspell/bin/")
; Tell emacs to use Aspell and provide the location of custom dictionary
(setq ispell-program-name "aspell")
(setq ispell-personal-dictionary "C:/emacs/.emacs.d/my_dict/my_dict.ispell")
; Turn it on
(require 'ispell)


;;; Flyspell configuration
(add-to-list 'load-path "~/.emacs.d/flyspell")
(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
(autoload 'flyspell-delay-command "flyspell" "Delay on command." t)
(autoload 'tex-mode-flyspell-verify "flyspell" "" t)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)  ; Auto-start flyspell with LaTeX


;;; Enable auto-complete mode
(require 'auto-complete)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(require 'auto-complete-config)
(ac-config-default)
(global-auto-revert-mode t)


;;; RefTex configuration
(require 'reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(add-hook 'latex-mode-hook 'turn-on-reftex)


;;; Activate code folding in AUCTeX
(add-hook 'LaTeX-mode-hook (lambda ()
             (TeX-fold-mode 1)))


;;; Setup jedi
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)


;;; Pair braces and quotes automatically (autopair)
(require 'autopair)
(autopair-global-mode) ;; Enable autopair in all buffers


;; (setq py-install-directory "~/.emacs.d/python-mode.el-6.1.3")
;; (add-to-list 'load-path py-install-directory)
;; (require 'python-mode)

(require 'python)
(setq python-shell-interpreter "ipython")
(setq python-shell-interpreter-args "--pylab")

I'm not familair enough with the python.el code to give you a good answer, but if you look at the beginning of python.el (the "Commentary:" section), you'll see it talks a bit about how to use Ipython. 我对python.el代码不够熟悉,无法给您一个很好的答案,但是如果您看一下python.el的开头(“注释:”部分),您会发现它在谈论如何使用Ipython。 This said, there has been various problems with it. 这就是说,它存在各种问题。 The python.el code in the upcoming 24.4 has significantly improved the Ipython support, so it doesn't require all that configuration and actually works (supposedly). 即将发布的24.4中的python.el代码大大改进了对Ipython的支持,因此它不需要所有配置,并且可以正常工作(假定)。 Since 24.4 is very close to a release, we're looking for people who can help us get rid of the final few bugs, so it would be great if you could try the latest pretest (24.3.94) to see if that solves your problem, and if not, do a Mx report-emacs-bug so we can fix it before the release. 由于24.4即将发布,我们正在寻找可以帮助我们摆脱最后几个错误的人员,因此,如果您可以尝试最新的预测试(24.3.94),看看是否可以解决您的问题,那就太好了问题,如果不是这样,请执行Mx report-emacs-bug以便我们可以在发行前对其进行修复。

I had this same problem with Emacs 24.3.1 on Windows, and all my woes were finally fixed by shoehorning the ipython process into a subprocess (I tried everything I could from the "commentary" section to no avail - maybe Shaun knows exactly what he changed that fixed it?). 我在Windows上的Emacs 24.3.1遇到了同样的问题,最终我的所有麻烦都通过将ipython进程拖入了子进程而得以解决(我尝试了从“注释”部分可以做的所有事情-也许Shaun知道他到底是什么)改变了它固定的?)。 You get an extra python process in the mix but I haven't had any issues with control between a code buffer and the python buffer. 您在混合中得到了一个额外的python进程,但是我在代码缓冲区和python缓冲区之间的控制方面没有任何问题。 From my .emacs: 从我的.emacs:

(setq
 python-shell-interpreter "C:\Python27\\python.exe"
 python-shell-interpreter-args "-u -c \"import subprocess; subprocess.call('ipython')\""
 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")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM