emacs python3 mode_使用emacs(aquamacs)与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.

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 "", line 1, in

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 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.

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.

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.

Now it should work.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值