Skip to main content
 首页 » 编程设计

python之在 Emacs 中配置新模式 : installing python-mode. el

2025年05月04日7exmyth

我正在尝试使用 python-mode.el 配置 emacs。我做了很多研究,尽管我还是新手,因为我不确定如何配置所有内容。我使用了以下资源,它们很有帮助:

我一直在设置使用 Andrea 的方法,我相信我有资源,但我仍然有疑问:

  • 我有一个 .emacs 文件,我知道要删除它。我应该将我的 .emacs 文件的内容迁移到新文件 ~/.emacs.d/init.el 下吗?
  • 由于我打算使用 Andrea 的 init.el 文件,我是否应该将它与我旧的 .emacs 文件中的内容添加到一个 init.el 中 文件?
  • 我在 ~\.emacs.d\python-mode.el-6.1.2 下提取了 python-mode .tar.gz 文件。这是正确的,还是我应该使用像 ELPA 这样的包管理器?
  • 从 Andrea 的 README.md,我可以通过 pip install jedi epc pylint 安装 Jedi。我应该在哪里克隆 Jedi 存储库,我应该在哪里运行 pip install jedi epc pylint?
  • 我在 C:\Users\Lucas\AppData\Local\Enthought\Canopy\User 下安装了 Enthought 的 Canopy python 2.7,其中有 python.exe 和 libs(包含我需要的所有库),但我不确定这个位置将来是否会给我带来问题。我应该在 C:\ 下重新安装 python 2.7 吗?

我使用的是 Emacs 24.3 版 操作系统:Windows 7

请您参考如下方法:

I have a .emacs file, which I know to remove. Should I migrate the contents of my .emacs file under a new file, ~/.emacs.d/init.el? Since I plan to use Andrea's init.el file, should I add it with the contents from my old .emacs file into a single init.el file?

您不需要。但我建议你这样做。你也不需要将你的 config 添加到 Andrea 的 init.el,你可以在一个单独的文件中说 ~/.emacs.d/my- config.el,然后通过将 (load "~/.emacs.d/my-config.el") 从 init.el 加载到Andrea 的 init.el。

I extracted the python-mode .tar.gz file under ~.emacs.d\python-mode.el-6.1.2. Is this correct, or should I use a package manager like ELPA?

我怀疑你是否需要这个,因为 Andrea 的配置已经安装了 python-mode。

From Andrea's README.md, I can install Jedi via pip install jedi epc pylint. Where should I clone the Jedi repository, and where should I run pip install jedi epc pylint?

您不需要克隆 Jedi 存储库。您可以从任意位置运行 pip install jedi epc pylint。

I have Enthought's Canopy python 2.7 installed under C:\Users\Lucas\AppData\Local\Enthought\Canopy\User, which has python.exe along with libs(with all the libraries I'll need), but I am not sure if this location will cause me problems in the future. Should I re-install python 2.7 under C:\?

只要 C:\Users\Lucas\AppData\Local\Enthought\Canopy\User 如果在您的路径中,这应该可以正常工作。