在emacs中启动ipython时没有提示

2024-10-04 03:22:28 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试在ipythonc控制台上键入python-ythemac来启动脚本。但是ipython控制台看起来是空白的。虽然当我输入一些命令时,会有一个输出并显示Out提示。此外,当我退出()时,会显示许多In()提示符。为什么会这样?在

Ipython console on exit

我使用的是EmacsVersion24.3、iPython2.1.0和Python2.7.6。以下是我的初始标高在

;;; 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")

Tags: toaddautoonmoderequirehooklist
2条回答

我在Windows上使用emacs24.3.1时也遇到了同样的问题,我所有的麻烦最终都通过将ipython进程压缩成一个子进程来解决(我尝试了从“评论”部分所能做的一切,但都没有用——也许肖恩确切地知道他对它做了什么修改,从而解决了这个问题?)。混合中有一个额外的python进程,但是我在代码缓冲区和python缓冲区之间的控制方面没有任何问题。从my.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")

我不太熟悉Python.el代码可以给你一个很好的答案,但是如果你看一开始Python.el(“评论:”部分),您将看到它讨论了一些如何使用Ipython。这就是说,它有各种各样的问题。这个Python.el即将发布的24.4版本中的代码极大地改进了Ipython支持,因此它不需要所有的配置,而且实际上可以工作(假设)。因为24.4离发布非常近,所以我们正在寻找能够帮助我们消除最后几个bug的人,所以如果您可以尝试最新的pretest(24.3.94)来看看它是否解决了您的问题,如果不能,请做一个M-x report-emacs-bug这样我们就可以在发布之前修复它了。在

相关问题 更多 >