py-python-command被忽略了

时间:2011-08-21 23:02:58

标签: emacs python-mode

我在OS X上使用python-mode 6.0.1,emacs 23.3(http://emacsformacosx.com/版本)。

我正试图让C-c C-c默认为python 3。

我的.emacs中有以下内容:

(setq py-python-command "/usr/local/bin/python3")

当我运行C-h b py-python-command时,它告诉我值(正确)。

但是,正在运行C-c C-c仍会打开2.7.2。

我也尝试添加:

(setq py-which-shell "/usr/local/bin/python3")

正如这里建议的那样:Both Python 2 and 3 in Emacs,但这并没有改变任何东西(py-which-shell确实发生了变化,但它仍然启动了2.7.2)。

有什么想法吗?

2 个答案:

答案 0 :(得分:1)

尝试将以下代码添加到您的Emacs init文件中:

(add-hook 'python-mode-hook
            (lambda ()
              (setq py-python-command "python3")
              (setq py-default-interpreter "python3")))

答案 1 :(得分:0)

py-default-interpreter for now现在只是一个别名,为了向后兼容而提供

您可能遇到过错误。

请提交一份报告,提供一些示例代码 https://bugs.launchpad.net/python-mode

如果缓冲区代码包含指定pythonVERSION的shebang,则优先于默认设置。

您可以通过调用强制执行特定pythonVERSION的执行缓冲区 类py-execute-buffer-pythonVERSION

的命令

参见菜单PyExec,条目Execute buffer ...