【问题标题】:ipython from emacs on windows XP, no prompt and no print outputWindows XP上来自emacs的ipython,没有提示,也没有打印输出
【发布时间】:2010-12-17 08:54:44
【问题描述】:

我想在 windows XP 上将 ipython 集成到 emacs 23。 我可以在网上找到相当多的信息,但没有任何作用。

我的~/.emacs.d/init.el中需要以下内容:

  • python 模式
  • pymacs
  • ipython

pyreadline 也已安装。

我使用 bat 文件(在我的系统路径中)启动 ipython,带有标志 -i 和 -u。

信息正文

c:\Program\emacs-23.2\bin>c:\program\python27\scripts\ipython -i -u

Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 0.10.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'. ?object also works, ?? prints more.

在我编写第一个命令之前不会出现。

我没有得到任何提示。 写入和“执行”数字确实会产生红色的“Out[n]:”和数字。 Print 不提供任何东西。 a 给出一个彩色的 ipython 错误文本,以 NameError: name 'a' not defined 结尾。

换句话说,错误流似乎没问题,标准输出似乎没问题,但print 和负责打印提示的任何东西似乎都找不到正确的流。


emacs *Message* 缓冲区说:

comint-send-string: Output file descriptor of Python<1> is closed

对于 python shell 中的每个输出(未出现)。

【问题讨论】:

  • 您找到解决方案了吗?
  • @Natan:不,我使用单独的提示符。
  • 我在使用 emacs 24 时遇到了完全相同的问题。

标签: python emacs ipython


【解决方案1】:

确保您使用的是pyreadline 1.6。 1.5 版使用控制台 API 写入流,即使通过 Emacs 运行也是如此。这会导致许多与您所看到的问题相似的问题。

【讨论】:

  • 感谢您的回答。我的 pyreadline 版本是 1.6.1.win32。
【解决方案2】:

我相信接收-u参数的是Python解释器本身,而不是ipython脚本,即你的文件C:\Program\Python27\scripts\ipython.bat应该包含如下内容:

@C:\Program\Python27\python.exe -u C:\Program\Python27\scripts\ipython.py %*

【讨论】:

  • 既然 %* 存在,-u 参数无论如何都应该通过? -u -i 在 python 脚本名称之前还是之后有关系吗?
  • 是的,这很重要。通常,解释器会忽略脚本名称后的所有选项,假设它们是针对脚本的。
  • 我明白了。我没有运气测试了这个。正如我在更新中所写,我得到“Python 的输出文件描述符已关闭”。
猜你喜欢
  • 1970-01-01
  • 2011-05-11
  • 1970-01-01
  • 2021-10-26
  • 1970-01-01
  • 2021-11-10
  • 1970-01-01
  • 1970-01-01
  • 2018-04-11
相关资源
最近更新 更多