使用emacs(aquamacs)与python 3.2 [英] Use emacs(aquamacs) with python 3.2
问题描述
Mac osx雪豹上的默认python版本是python 2.6.1。我正在学习python 3,所以我必须改变口译员。我已经改变了这个设置,所以它指向 /Library/framework/python.framework/version/3.2/bin/python3.2
。我相信这是我的3.2解释器的安装位置。
当我重新启动Emacs,一切都正常。当我开始翻译时,它说python 3.2:
The default python version on mac osx snow leopard is python 2.6.1. I am learning python 3, so I have to change the interpreter. I have changed the setting in preference, so that it points to /Library/framework/python.framework/version/3.2/bin/python3.2
. I believe that is where my 3.2 interpreter is installed.
When I restart Emacs, everything works fine. When I start the interpreter, it says python 3.2:
Python 3.2 (r32:88452, Feb 20 2011, 11:12:31)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
但是,当我要求Emacs执行缓冲区时,会显示以下消息:
However, when I ask Emacs to execute a buffer, this message shows up:
execfile(r'/var/folders/yV/yVXYrzONGSaZeoBmB-mdkE+++TI/-Tmp-/python-2180L5f.py') # PYTHON-MODE
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'execfile' is not defined
我不知道如何修复它。它与我的代码无关,因为即使我尝试执行这个消息显示:
I don't know how to fix it. It has nothing to do with my code though, because this message shows up even when I try to execute:
print ("Hello World")
推荐答案
这是一个较长的答案,因为我不得不研究一下。
This is a longer answer, as I had to look into it.
-
需要在系统上安装Python 3。我已经安装了HomeBrew,所以这涉及到
$ brew install python3
。您可以使用其他方法安装。
Python 3 will need to be installed on your system. I already installed HomeBrew, so this involved
$ brew install python3
. You can install with other methods as well.
我使用一个virtualenv for Python 3.我通过使用 virtualenv - P python3 myproj
Aquamacs让你 Mx virtualenv-activate
来设置它。
I use a virtualenv for Python 3. I make a virtualenv by using the virtualenv -P python3 myproj
Aquamacs lets you M-x virtualenv-activate
to set it.
在 python-mode.el
文件中存在一些问题,一个Lisp文件隐藏在您的 /Applications/Aquamacs.app/Contents/Resources中/口齿不清/ aquamacs /编辑模式/蟒模式
。 Andreas Roehler 修补了 bug 。如果主要的蟒蛇模式页面仍然在6.1.2版本,那么您将下载一个新的 python-mode.el
这里,并将其复制到现有版本。
There were problems in the python-mode.el
file, a lisp file hiding down in your /Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/edit-modes/python-mode
. Andreas Roehler patched the bug. If the main python-mode page is still on version 6.1.2, you download a new python-mode.el
here and copy it over your existing version.
现在应该工作。
这篇关于使用emacs(aquamacs)与python 3.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!