问题
Im starting development with python, and tried some simple commands like calculations.
But, some times python aborts with "Segmentation fault:11" In google i didnt find a similar issue or solution for that.
Python is installed with homebrew. home-brew doctor command don't show any issues for the python installation and is up to date.
Have anyone an Idea how to fix this ?
Here is the OSX Crash Log: http://pastebin.com/rKpPJKxJ
回答1:
Hmmm... spread the word. The following seems that it fixed it:
cd /Library/Frameworks/Python.framework/Versions/3.3
cd ./lib/python3.3/lib-dynload
sudo mv readline.so readline.so.disabled
回答2:
This is a bug in the python interpreter related to readline compatibility that has been fixed in the most recent candidates that were cut this weekend.
http://python.org/download/releases/2.7.6/
http://python.org/download/releases/3.3.3/
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.
回答3:
I hit this issue on El Capitan when I installed Homebrew and had to adjust my PATH variable to put /usr/local/bin up front. Python version in there was 2.7.3. Python in /usr/bin is 2.7.10. Removing the python symlink in /usr/local/bin/ did the trick.
回答4:
Is there a reason you did not just use the official version, which is thoroughly tested via the built in test suite before being released?
See: http://www.python.org/download/releases/2.7.5/ or http://www.python.org/download/releases/3.3.2/ and download the appropriate dmg. If you still have problems with the official version, you are likely either doing something very bad (stack overflow or memory corruption using something like ctypes), you have a hardware problem, or you have corrupt software on your system.
来源:https://stackoverflow.com/questions/18768967/python-segmentation-fault-11-on-osx