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

发布于 2024-12-18 12:32:35 字数 695 浏览 6 评论 0原文

我一直在尝试在运行 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

热情消退 2024-12-25 12:32:35

这是不幸的,因为 OS X 上越来越多的 Python 发行版是使用 Apple 在 OS X 中提供的 libedit 构建的,而不是使用 Apple 所做的 GPL 许可的 GNU readline 库不发货。例如,当前 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 以便与 libeditreadline 正常工作。如果存在 Python 错误抑制这一点,则应归档针对 Python 本身的错误。另外,也许可以说服 PyPI 上的 readline 包的维护者构建并发布 3.2 二进制包。

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

$ export PATH=/Library/Frameworks/Python.framework/Versions/3.2/bin:$PATH

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

$ curl -O http://python-distribute.org/distribute_setup.py
$ python3.2 distribute_setup.py

则从 PyPI 下载、构建并安装 readline 包:

$ easy_install-3.2 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 GNU readline library which Apple does not ship. For instance, current 64-bit/32-bit python.org installers for OS X use libedit while the 32-bit-only installers currently use readline since libedit 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 either libedit or readline. If there are Python bugs inhibiting that, bugs against Python itself should be filed. Also, perhaps the maintainers of the readline 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:

$ export PATH=/Library/Frameworks/Python.framework/Versions/3.2/bin:$PATH

Then if you have not already installed Distribute for Python 3.2:

$ curl -O http://python-distribute.org/distribute_setup.py
$ python3.2 distribute_setup.py

Then download, build, and install the readline package from PyPI:

$ easy_install-3.2 readline

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.

Spring初心 2024-12-25 12:32:35

您有类似 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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文