libedit/readline与OS X 10.7 Lion上的ipython 3.2.2冲突

gnr*_*gnr 4 python readline ipython easy-install python-3.x

我一直在尝试在运行Lion的mac上设置ipython 3(运行2.7正常),但似乎无法摆脱以下错误:

192:~ mlauria$ /Library/Frameworks/Python.framework/Versions/3.2/bin/ipython3
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages\
/IPython/utils/rlineimpl.py:96: RuntimeWarning: Leopard libedit detected - \
readline will not be well behaved including some crashes on tab completion, and \
incorrect history navigation. It is highly recommended that you install readline,\
which is easy_installable with: 'easy_install readline'
  RuntimeWarning)
Python 3.2.2 (v3.2.2:137e45f15c0b, Sep  3 2011, 17:28:59)
Run Code Online (Sandbox Code Playgroud)

easy_install readline在ipython 2.7上正确地解决了这个问题,但是这并没有修复3.2.

Ned*_*ily 6

这是不幸的,因为越来越多的OS X上的Python发行版正在使用Apple提供libedit的OS X而不是Apple未提供的GPL许可的GNU readline库构建.例如,当前64位/ 32位python.org安装的OS X使用libedit而32比特仅目前安装程序使用readline,因为libedit是在较旧版本的OS X的越野车尽管32位只安装用于Python 3.2可以安装在10.7上,如果你需要安装任何C扩展模块,那么在10.7上会出现问题,因为Python是使用10.7不支持的旧版10.4u SDK和ppc arch构建的.理想情况下,应该修改iPython以使用libedit或者正常工作readline.如果有Python错误抑制,那么应该提交针对Python本身的错误.此外,也许readline可以说服PyPI 上的包的维护者来构建并放置3.2二进制包.

否则,您可以使用其源代码分发自行构建它,假设您已为Lion安装了Xcode.如果Python 3.2 bin框架不在您的路径中,您需要执行以下操作:

$ export PATH=/Library/Frameworks/Python.framework/Versions/3.2/bin:$PATH
Run Code Online (Sandbox Code Playgroud)

然后,如果您尚未安装Distribute for Python 3.2:

$ curl -O http://python-distribute.org/distribute_setup.py
$ python3.2 distribute_setup.py
Run Code Online (Sandbox Code Playgroud)

然后readline从PyPI 下载,构建和安装包:

$ easy_install-3.2 readline
Run Code Online (Sandbox Code Playgroud)

或者您可以从像MacPorts这样的第三方分销商安装Python 3.2版本,它提供了一个readline端口(py32-readline)和一个iPython端口.