分段错误:OS X 中的 11 [英] Segmentation fault: 11 in OS X

查看:27
本文介绍了分段错误:OS X 中的 11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 OSX 10.9 上的 Python 3.3.2 中遇到一个问题,如果我在终端窗口中打开 Python,它会在我输入的第二行之后以分段错误:11"退出,无论这两个命令是什么.例如,如果我输入:

<预><代码>>>>对于范围内的 x(1000):打印(x)

效果很好,但如果我输入:

<预><代码>>>>对于范围内的 x(1000):... 打印(x)

然后当我在第二行按回车键时出现错误.我也可以运行超过 2 行的脚本,没有任何问题.

我今天下午更新到 OSX 10.9,所以我怀疑可能是这样.

但是,我最近刚刚安装了 IPython(以及其他几个软件包)并且过去几天一直在使用它,所以它可能是我最近安装的其他东西.我在运行 configure.py 的地方安装 PyQt 时有几次不成功的尝试,但随后make"命令失败了,我也对此表示怀疑.

我尝试重新安装 Python,但没有解决问题.IPython 和 IDLE 都可以正常工作.我只是担心潜在的问题是什么.

解决方案

这是 python 中 readline 兼容性的一个错误,与 OSX10.9 中引入的更改有关.本周末,发布了 Python2.7.6 和 Python3.3.3 的候选版本,修复了这个错误.下载链接如下.

http://python.org/download/releases/2.7.6/

http://python.org/download/releases/3.3.3/

这里是问题,引自 Ned Deily,写在 python-dev 电子邮件列表.

<块引用>

周二,Apple 发布了 OS X 10.9(又名 Mavericks).已经有对它很感兴趣,部分原因是 Apple 已将其提供给免费,并让使用 10.8、10.7 和(大多数)10.6 系统的用户轻松使用直接升级到10.9.不幸的是,我们目前存在问题OS X 10.9 上的维护版本(3.3.2 和 2.7.5)需要新的尽快发布维护版本.

一个很关键,因为它会导致解释器在运行时崩溃交互模式(http://bugs.python.org/issue18458).问题是由于libedit 的 readline 兼容层中长期存在的兼容性问题上游终于修复了,Apple 现在已经在 10.9 中发货了.因为python.org 安装程序动态链接到 libedit,原始解决方法在 readline.c 中,历史索引中的原始设计缺陷现在导致当用户以交互方式输入第二个命令时,10.9 上的段错误.不是好的.Ronald 设计了一个修复程序,允许 readline.so 在运行时检测和使用任一版本的 libedit,以便我们继续拥有二进制文件跨多个 OS X 版本的兼容性.该修复程序已经在3.4.0 alphas 并反向移植到 3.3 和 2.7 分支,等待发布那里.就在过去的 12 小时内,至少有四个重复的用户报告的问题.我已将原始问题更新为明确提到 10.9,现在它不再受 NDA 约束,并提供一个可供没有经验的用户下载的脚本来解决问题删除"readline.so.据推测,随着消息传出,会越来越少重复的问题已打开,但影响仍然存在.

I am getting an issue in Python 3.3.2 on OSX 10.9 where if I open Python in a terminal window, it exits with "Segmentation error: 11" after the second line I enter, regardless of what the two commands are. For example, if I enter:

>>> for x in range(1000): print(x)

that works fine, but if I enter:

>>> for x in range(1000):
...     print(x)

then I get the error when I press enter on the second line. I can also run a script with more than 2 lines without any problems.

I updated to OSX 10.9 this afternoon, so I suspect that may be it.

However, I just recently installed IPython (along with several other packages) and have been using that the past couple of days, so it could be something else I installed recently. I had a couple unsuccessful attempts at installing PyQt where I ran configure.py but then the "make" command failed, which I was also suspicious of.

I tried reinstalling Python, but it didn't resolve the issue. Both IPython and IDLE work with no problems. I'm just concerned about what could be the underlying issue.

解决方案

This is a bug in the readline compatibility in python, related to changes introduced in OSX10.9. This weekend, release candidates for Python2.7.6 and Python3.3.3 were released which fix this bug. The download links are below.

http://python.org/download/releases/2.7.6/

http://python.org/download/releases/3.3.3/

Here's the issue, quoting from Ned Deily, writing on the python-dev email list.

On Tuesday, Apple released OS X 10.9 (a.k.a. Mavericks). There has already been a lot of interest in it, in part because Apple has made it available for free and has made it easy for users with 10.8, 10.7, and (most) 10.6 systems to upgrade directly to 10.9. Unfortunately, there are issues with our current maintenance releases (3.3.2 and 2.7.5) on OS X 10.9 that call for new maintenance releases as soon as possible.

One is critical in that it causes the interpreter to crash when running in interactive mode (http://bugs.python.org/issue18458). The problem was due to a long-standing compatibility issue in libedit's readline compatibility layer that upstream has finally fixed and Apple has now shipped in 10.9. Because the python.org installers dynamically link to libedit, the original workaround in readline.c for the original design flaw in history indexing now causes a segfault on 10.9 when the user types in the second command interactively. Not good. Ronald devised a fix that allows readline.so at runtime to detect and work with either version of libedit so that we continue to have binary compatibility across multiple OS X releases. That fix is already out in the 3.4.0 alphas and backported to the 3.3 and 2.7 branches, awaiting release there. Just in the last 12 hours, there have been at least four duplicates of the issue reported by users. I've updated the original issue to explicitly mention 10.9, now that it is no longer under NDA, and to provide a downloadable script for inexperienced users to workaround the problem by "removing" readline.so. Presumably, as word gets out, there will be fewer duplicate issues opened but the impact will remain.

这篇关于分段错误:OS X 中的 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆