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

问题描述

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

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)

然后在第二行按Enter键时出现错误.我也可以运行两行以上的脚本,而不会出现任何问题.

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.

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

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

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

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.

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

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.

推荐答案

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

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/

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

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

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

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 00:14