我当前在 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 文件中,我用 "Cc !" 启动 python 解释器。(py 壳)。我用“抄送|”评估代码区域 (py 执行区域)。
如果我单独执行以下每一行,
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
>>>
问题:
这些行为是否正确(没有显示正在评估哪些代码,也没有显示 python 解释器通常会打印什么)?
如何设置它以便 python shell 像终端中的普通 python 解释器一样打印输出?(打印输入代码和输出)
我想我已经习惯了 R 的 ESS。谢谢。