libedit/readline 与 OS X 10.7 Lion 上的 ipython 3.2.2 冲突
我一直在尝试在运行 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)
easy_install readline 可以正确地在 ipython 2.7 上修复此问题,但这并不'修复 3.2。
I've been trying to set up ipython 3 (running 2.7 works fine) on a mac running Lion, but can't seem to get rid of the following error:
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)
easy_install readline worked correctly to fix this on ipython 2.7, but this doesn't fix 3.2.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是不幸的,因为 OS X 上越来越多的 Python 发行版是使用 Apple 在 OS X 中提供的
libedit
构建的,而不是使用 Apple 所做的 GPL 许可的 GNUreadline
库不发货。例如,当前 OS X 的 64 位/32 位 python.org 安装程序使用libedit
,而仅 32 位安装程序当前使用readline
,因为libedit
在旧版本的 OS X 上有错误。虽然 Python 3.2 的 32 位安装程序可以安装在 10.7 上,但如果您需要安装任何 C 扩展模块,则在 10.7 上会出现问题,因为 Python 是使用较旧的 10.4u SDK 和 ppc 架构构建的,10.7 不支持这些架构。理想情况下,应该修改 iPython 以便与libedit
或readline
正常工作。如果存在 Python 错误抑制这一点,则应归档针对 Python 本身的错误。另外,也许可以说服 PyPI 上的 readline 包的维护者构建并发布 3.2 二进制包。否则,假设您已经安装了 Xcode for Lion,您可以使用他们的源代码发行版自行构建它。如果 Python 3.2 bin 框架不在您的路径中,您需要执行以下操作:
如果您尚未安装 Distribute for Python 3.2:
则从 PyPI 下载、构建并安装
readline
包:或者您可以从第三方发行商(例如 MacPorts)安装 Python 3.2 版本,该发行商确实提供了 readline 端口 (py32-readline) 以及 iPython 端口。
This is unfortunate as more and more Python distributions on OS X are being built with the Apple-supplied
libedit
in OS X rather than the GPL-licensed GNUreadline
library which Apple does not ship. For instance, current 64-bit/32-bit python.org installers for OS X uselibedit
while the 32-bit-only installers currently usereadline
sincelibedit
was buggy on older versions of OS X. While the 32-bit-only installer for Python 3.2 can be installed on 10.7, it is problematic on 10.7 if you need to install any C extension modules, as that Python was built with the older 10.4u SDK and ppc archs which are not supported on 10.7. Ideally, iPython should be modified to work correctly with eitherlibedit
orreadline
. If there are Python bugs inhibiting that, bugs against Python itself should be filed. Also, perhaps the maintainers of thereadline
package on PyPI can be persuaded to build and put a 3.2 binary package out there.Otherwise you can build it yourself using their source distribution, assuming you have installed Xcode for Lion. If the Python 3.2 bin framework is not in your path, you'll need to do:
Then if you have not already installed Distribute for Python 3.2:
Then download, build, and install the
readline
package from PyPI:Or you could install a version of Python 3.2 from a third-party distributor like MacPorts which does provide a
readline
port (py32-readline
) along with an iPython port.您有类似
easy_install-3.2
的命令吗?查看 PyPI 上的 readline,看起来没有为 Python 3 构建的二进制文件,所以您可能需要相关的东西来从源代码编译它(除非您可以在其他地方找到 Python 3 构建)。
Do you have a command called something like
easy_install-3.2
?Looking at readline on PyPI, it looks like there isn't a binary built for Python 3, so you'll probably need the relevant stuff to compile it from source (unless you can find a Python 3 build elsewhere).