问题描述
我想使用 python 在 emacs 中自动完成和重构.
I want autocompletion and refactoring in emacs with python.
我想我需要绳索才能做到这一点.要使用 emacs 做到这一点,我需要ropemacs.Ropmacs 依赖于 pymacs.
I gather that I need rope to do this. To do this with emacs, I need ropemacs. Ropmacs depends on pymacs.
Pymacs 很难安装……或者至少我不清楚说明.
Pymacs is hard to install...or at least the instructions are not clear to me.
我需要做两件事吗?安装pymacs,然后安装一个文件,告诉emacs 与pymacs 对话?我已经非常轻松地安装了rope和ropemacs,
Do I need to do two things? Install pymacs and then install a file that tells emacs to talk to pymacs? I've already installed rope and ropemacs super easily, with
pip 安装绳ropemacs
这是我所做的:
pip install -e "git+https://github.com/pinard/Pymacs.git#egg=Pymacs"
根据 PIP,这在 mac os x 山狮上安装没问题.
This installs ok on mac os x mountain lion according to PIP.
但我有一种感觉,我还没有完成——或者我完成了吗?
But I have a feeling that I am not done--or am I?
如何测试 pymacs 和rope 以及ropemacs 是否都正常工作?
How do I test to see if pymacs and rope and ropemacs are all working?
推荐答案
安装部分 Pymacs 手册相当简单——如果不确定,不要害怕参考它.下面是在 Emacs 24 中安装 Pymacs 的步骤.首先,在 shell 中,运行:
Installation section of Pymacs manual is fairly straightforward — don't be afraid to refer to it if unsure. Below are the steps to install Pymacs in Emacs 24. First, in shell, run:
sudo pip install rope ropemacs
之后在 Emacs 中通过添加 Marmalade 存储库 然后运行 package-install pymacs
.截至 2014 年 2 月,您无法通过 pip
安装 Pymacs,因此:
After that in Emacs install Elisp side of Pymacs by adding Marmalade repository and then running package-install pymacs
. As of February 2014 you can't install Pymacs via pip
, therefore:
git clone http://github.com/pinard/pymacs
cd pymacs
make check
sudo make install
make check
确保先决条件.sudo make install
将 Pymacs 模块放在 Python 本地模块路径中,通常是 /usr/local/lib/python2.7/dist-packages/
.人们通常不喜欢make install
,因为如果丢失了Makefile,就很难彻底卸载.但是你不应该害怕它,因为 pip
使用相同的目录,所以 pip uninstall pymacs
会起作用.
make check
ensures the prerequisites. sudo make install
puts Pymacs module in Python local modules path, usually /usr/local/lib/python2.7/dist-packages/
. People generally frown upon make install
, because if you lose the Makefile, it can become hard to cleanly uninstall. But you shouldn't fear it, as pip
uses the same directory, so pip uninstall pymacs
will work.
在 ~/.emacs.d/init.el
中输入:
In ~/.emacs.d/init.el
put:
;; Pymacs
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t)
(autoload 'pymacs-autoload "pymacs")
使用 eval-region
评估它并尝试使用 pymacs-eval
运行 Python 表达式.你可以走了.
Evaluate this with eval-region
and try running Python expressions with pymacs-eval
. You're good to go.
这篇关于使用 emacs 24 安装 pymacs 的明确步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!