如何在Cygwin下的Emacs中为我的Enthought Python Distrubution安装运行IPython?

时间:2014-05-06 17:51:18

标签: emacs cygwin ipython enthought

我喜欢Emacs,但我使用的是Windows 7.我已经安装了Cygwin,可以使用Emacs进行基本的编辑任务。我可以设置Emacs来运行IPython的Cygwin安装,但我宁愿运行IPethon的Enthought Python Distribution版本。

根据here的建议,我将以下内容添加到~/.emacs文件中:

(when (executable-find "ipython")
  (setq
   python-shell-interpreter "/cygdrive/c/Python27/Scripts/ipython.bat"
   python-shell-interpreter-args ""
   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"))

注意我修改了第三行以指向ipython.bat。然后我启动解释器,它加载EPD,但我得到以下错误,无法做任何事情:

---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
C:\Users\username\My Documents\python\<ipython-input-2-6552ae2ca310> in <module>()
----> 1 __pyfile = open('''/tmp/py6644bAS''');exec(compile(__pyfile.read(), '''/tmp/py6644bAS''', 'exec'));__pyfile.close()

IOError: [Errno 2] No such file or directory: '/tmp/py6644bAS'
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
C:\Users\username\My Documents\python\<ipython-input-3-492fce3681b4> in <module>()
----> 1 __pyfile = open('''/tmp/py6644XOK''');exec(compile(__pyfile.read(), '''/tmp/py6644XOK''', 'exec'));__pyfile.close()

IOError: [Errno 2] No such file or directory: '/tmp/py6644XOK'

允许我通过Cygwin在Emacs中运行EPD的IPython安装的任何想法或其他方法?

1 个答案:

答案 0 :(得分:0)

这里有一种方法可以调整使用Anaconda的python-mode.el - 不完全是你想要的,但它可能会提供一些提示:

(defun ipython (&optional argprompt)
  "Start an IPython interpreter.

Optional \\[universal-argument] prompts for options to pass to the IPython interpreter. See `py-python-command-args'. "
  (interactive "P")
  (setq py-ipython-command "C:\\Users\\MYNAME\\Anaconda\\Scripts\\ipython.exe")
  (py-shell argprompt nil py-ipython-command))