emacs中的Ipython将垃圾文本转储到shell中

emacs中的Ipython将垃圾文本转储到shell中,emacs,ipython,Emacs,Ipython,当我在emacs缓冲区中启动ipython进程时,它会将垃圾文本打印到缓冲区: ^[[J^[[?7h^[[?12l^[[?25h^[[?2004l ^[[?12l^[[?25h 每次我启动ipython缓冲区时,每次我计算另一个缓冲区中的代码时,每次我计算该缓冲区中的代码时,ipython缓冲区都会这样做。Ipython从未从bash CLI中执行此操作,在[1]: 我在哪里可以将此行为更改为更明智、更简洁的提示,例如ipython在bash中所做的操作 这是tmux 2.0中的emacs 2

当我在emacs缓冲区中启动ipython进程时,它会将垃圾文本打印到缓冲区:

^[[J^[[?7h^[[?12l^[[?25h^[[?2004l
^[[?12l^[[?25h
每次我启动ipython缓冲区时,每次我计算另一个缓冲区中的代码时,每次我计算该缓冲区中的代码时,ipython缓冲区都会这样做。Ipython从未从bash CLI中执行此操作,
在[1]:

我在哪里可以将此行为更改为更明智、更简洁的提示,例如ipython在bash中所做的操作

这是tmux 2.0中的emacs 24.5.1版本,其中包含python 2.7.6、ipython 5.1.0、python模式版本6.2.1,运行在Ubuntu 14.04 LTS上

下面是我的.emacs文件中提到python的每一行:

; (require 'python-settings)

; (require 'ein)

(setq py-install-directory "~/.emacs.d/python-mode")

(add-to-list 'load-path py-install-directory)

(require 'python-mode)

(setq python-shell-interpreter "~/anaconda2/bin/python"
      python-shell-interpreter-args "-i console --matplotlib")

(setq-default py-shell-name "ipython")

(setq-default py-which-bufname "IPython")

; use the wx backend, for both mayavi and matplotlib
(setq py-python-command-args
  '("--gui=wx" "--pylab=wx" "-colors" "Linux"))

;; responsible for the annoying window rearrangement behavior after every code execution? Nope.

(setq py-force-py-shell-name-p t)

; switch to the interpreter after executing code

(setq py-shell-switch-buffers-on-execute-p nil)

(setq py-switch-buffers-on-execute-p nil)

(setq py-shell-local-path "/home/ftamborello/anaconda2/bin/python"
      py-use-local-default t)

; don't split windows

(setq py-split-window-on-execute-p nil)


; try to automagically figure out indentation

(setq py-smart-indentation t)

; enable flycheck syntax support

; (add-hook 'after-init-hook #'global-flycheck-mode)

Thomas K建议的是实际的解决方案,只需编辑init.el文件并粘贴以下内容:

RUN IPYTHON6.4 IN EMACS ALONG WITH PYTHON3+
(setq python-shell-interpreter "ipython3"
      python-shell-interpreter-args "-i --simple-prompt")

当从python模式内部而不是从普通shell调用IPython时,不应该发生这种情况。如果仍然出现错误,请将其报告为错误。如果您使用的是Emacs“劣质外壳”模式,则它与IPython使用的新终端接口(prompt_toolkit)不完全兼容。您可以在emacs终端中启动它,或者使用
--simple prompt
选项禁用智能终端交互。我使用的是python-mode.el版本6.2.1中定义的IPy模式。OP似乎使用的是python-mode.el,这与emacs附带的python.el不同。