2014-10-01 45 views
2

我使用的是Ubuntu 14.04,emacs 24.3.1,python 2.7.6,ipython 1.2.1,python-mode 6.1.3。 Ipython在emacs中至少運行了一年,但是,自兩週前以來,我遇到了以下問題。如何配置emacs使用ipython

  1. 使用C-c!啓動默認的解釋器,ipython顯示爲我所希望的,但不是拆分框架並在另一個窗口中顯示,它會出現在原始代碼窗口中。 (這是一個小問題)
  2. 使用C-c |執行區域,Python解釋器啓動,並將代碼發送到Python解釋器,而不是IPython的解釋

我搜索的SO,但這個問題似乎太新,有一個答案。我GOOGLE了一下,發現這個頁面https://answers.launchpad.net/python-mode/+question/250905,嘗試過其中的方法,仍然沒有工作......任何人都可以幫我解決這個問題嗎?非常感謝!

我的.emacs蟒蛇部分看起來像

(require 'python-mode) 
    (setq-default py-shell-name "ipython") 
    (setq-default py-which-bufname "IPython") 
    ; switch to the interpreter after executing code 
    (setq py-shell-switch-buffers-on-execute-p t) 
    (setq py-switch-buffers-on-execute-p t) 
    ; don't split windows 
    (setq py-split-windows-on-execute-p nil) 

回答

1

爲了拆分窗口

(setq py-split-windows-on-execute-p t)

需要,RESP。重置爲默認值 - 示例中的最後一行。也許通過M-x自定義...檢查設置,這可能與init中的setq衝突。

選擇要執行的shell時:緩衝區中的shebang可能會覆蓋默認的py-shell-name。 當家當應該被忽略,使用

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

見菜單

的Python /定製/開關/口譯

一種簡單的方法本屆會議期間更改此值。

+0

非常感謝Andreas! (setq py-force-py-shell-name-p t)起作用!但是當(setq py-split-windows-on-execute-p t),當前的代碼窗口不斷分裂,直到有四個窗口,然後我記得爲什麼我將它設置爲零...無論如何,我會嘗試更多的調整。還有一個問題,有沒有辦法知道除了讀取python-mode.el之外哪個py- *變體做了什麼? – calbear 2014-10-03 05:30:54

+0

@calbear你可以檢查出當前的主幹:bzr分支lp:python-mode。 Bug lp:1361531尚未解決 - 但有些改進應該是可行的。 – 2014-10-05 15:21:45