python - 为什么 python 解释器不在 python 模式的 emacs python shell 缓冲区中打印输入代码和输出?

标签 python emacs ipython ess python-mode

我当前在 emacs 中的 python 设置是:

(setq py-shell-name "ipython") ;; sudo pip install ipython
(setq py-shell-name "/usr/local/bin/ipython")
(setq py-force-py-shell-name-p t)
(add-to-list 'load-path "~/.emacs.d/python-mode.el-6.1.0/") 
(setq py-install-directory "~/.emacs.d/python-mode.el-6.1.0/")
(require 'python-mode)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))

在 python 文件中,我用“C-c!”启动 python 解释器。 (py-外壳)。我用“C-c |”评估代码区域(py-execute-region).

如果我单独执行以下每一行,

x = "hello world"
x
print(x)

我在 python shell 缓冲区中得到以下内容:

Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: 
In [5]: 
In [6]: hello world

In [7]: 

如果我使用默认的 python 解释器,我得到

Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> >>> >>> hello world
>>> 

问题:

  1. 这些行为是否正确(没有显示正在评估的代码,也没有显示 python 解释器通常会打印的内容)?

  2. 如何设置它以便 python shell 像终端中的普通 python 解释器一样打印输出? (打印输入代码和输出)

我想我已经习惯了 R 的 ESS。谢谢。

最佳答案

您正在寻找可能会实现的功能。

在这种情况下,请将其作为问题提交至

https://answers.launchpad.net/python-mode

完成后,使用底部的“(+) 创建错误报告”。

它会创建一张工单,帮助我们跟踪问题。

或者,您可以创建蓝图并在之后链接票证。

到目前为止完成:

https://blueprints.launchpad.net/python-mode/+spec/print-input-code

此外,您的 init 显示了一些无用的代码 - 但无害。 “py-shell-name”的第二个设置采用第一个的符号。

“...-mode-alist”的东西已经在 python 模式下完成了,你不必关心。

关于python - 为什么 python 解释器不在 python 模式的 emacs python shell 缓冲区中打印输入代码和输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14651296/

相关文章:

python - 获取 pandas 数据框中每一列的唯一值 - 帮助我创建更小、更易于管理的数据框来执行指标

python - Maya Python : mel. eval(invertSelection;) 不起作用

python - 理解递归流

emacs - 水平或垂直最大化 Emacs Windows

python - ipython notebook pandas max 允许的列数

python - 如何用Python构建这个图?

Emacs 命令将代码缩进 4 个空格以格式化粘贴到 stackoverflow 帖子中

debugging - Emacs Cider Debugger 本地导航

python - 在IPython中如何获取Python驱动程序的路径

python - 循环保存图形