更改emacs中的python解释器

2024-04-27 09:34:27 发布

您现在位置:Python中文网/ 问答频道 /正文

Emacs使用的是python的旧版本(2.3),默认的python模式是我拥有的,有没有办法告诉Emacs使用我在主目录中拥有的新版本?

顺便说一句,我使用的是红帽发行版,没有根权限。


Tags: 版本权限模式emacs主目录办法红帽
3条回答

python-python-command是为老的“loveshack python.el”设计的。对于使用“gallina python.el”的Emacs的最新版本,请使用变量python-shell-interpreter

(setq python-shell-interpreter "/path/to/python")

https://www.emacswiki.org/emacs/PythonProgrammingInEmacs#toc2

通过.emacs:

尝试添加到您的~/.emacs文件:

(setq python-python-command "~/your/python/bin-dir/python")

或者

通过shell环境:

Emacs运行的python命令通常是python,因此您可以尝试更改路径的简单方法:

export PATH=~/your/python/bin-dir:$PATH

检查要调整的内容的自定义组是一个好习惯。只要做:

M-x customize-group RET python RET

你现在有多种选择,其中一个应该很有趣:

Python Python Command

您可以在那里自定义它并保存以供以后的会话使用。

相关问题 更多 >