py-python-命令被忽略

发布于 2024-11-30 20:20:50 字数 683 浏览 6 评论 0原文

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

我试图让 Cc Cc 默认为 python 3。

我的 .emacs 中有以下内容:

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

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

但是,运行 Cc Cc 仍会打开 2.7.2。

我还尝试添加:

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

按照此处的建议: Python 2 和 3在 Emacs 中,但这不会改变任何东西(py-which-shell 确实发生了改变,但它仍然启动 2.7.2)。

有什么想法吗?

I'm using python-mode 6.0.1 on OS X, emacs 23.3 (http://emacsformacosx.com/ version).

I'm trying to get C-c C-c to default to python 3.

I have the following in my .emacs:

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

And when I run C-h b py-python-command, it tells me the value is that (correctly).

However, running C-c C-c still opens 2.7.2.

I also tried adding:

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

as suggested here: Both Python 2 and 3 in Emacs, but that doesn't change anything (py-which-shell does get changed, but it still launches 2.7.2).

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

挥剑断情 2024-12-07 20:20:50

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

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

Try adding the following code to your Emacs init file:

(add-hook 'python-mode-hook
            (lambda ()
              (setq py-python-command "python3")
              (setq py-default-interpreter "python3")))
挥剑断情 2024-12-07 20:20:50

py-default-interpreter 目前只是一个别名,是为了向后兼容而提供的。

您可能遇到了错误。

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

缓冲区代码是否包含指定的 shebang pythonVERSION ,这优先于默认设置。

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

请参阅菜单 PyExec,条目执行缓冲区 ...

py-default-interpreter for now is an alias only, delivered for backward compatibility

You might have encountered a bug.

Please file a report giving some example code at
https://bugs.launchpad.net/python-mode

Should the buffer code contain a shebang specifying pythonVERSION , than this takes precedence over default setting.

You may enforce executing buffer through specific pythonVERSION by calling
a command of class py-execute-buffer-pythonVERSION

See menu PyExec, entry Execute buffer ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文