35

当我运行第二个命令时,Python 解释器崩溃了。我在网上搜索了这个错误,但没有找到任何东西。错误如下所示:

Python 2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13:18:45) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print 1
1
>>> print 2
Segmentation fault: 11

为什么?

我正在使用 Mac OS X Mavericks。我认为这是相关的,因为它是一个测试版。

编辑:

忘记了 OSX 提供的问题详细信息:

Process:         Python [11053]
Path:            /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier:      Python
Version:         2.7.5 (2.7.5)
Code Type:       X86-64 (Native)
Parent Process:  bash [9217]
Responsible:     Terminal [3148]
User ID:         501

Date/Time:       2013-08-10 00:29:28.571 -0300
OS Version:      Mac OS X 10.9 (13A524d)
Report Version:  11
Anonymous UUID:  6AF2C70A-1C80-7F45-3A3D-E30D0725CDFC

Sleep/Wake UUID: 7B2165E8-4B17-4E17-ADA7-BF9BCB380E8A

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

VM Regions Near 0:
--> 
    __TEXT                 0000000100000000-0000000100001000 [    4K] r-x/rwx SM=COW  /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   readline.so                     0x00000001002f2f97 call_readline + 647
1   org.python.python               0x0000000100008e22 PyOS_Readline + 274
2   org.python.python               0x000000010000a678 tok_nextc + 104
3   org.python.python               0x000000010000ae23 PyTokenizer_Get + 147
4   org.python.python               0x0000000100005a1a parsetok + 218
5   org.python.python               0x00000001000e8a52 PyParser_ASTFromFile + 146
6   org.python.python               0x00000001000e9d33 PyRun_InteractiveOneFlags + 243
7   org.python.python               0x00000001000ea01e PyRun_InteractiveLoopFlags + 78
8   org.python.python               0x00000001000ea831 PyRun_AnyFileExFlags + 161
9   org.python.python               0x00000001001014ed Py_Main + 3101
10  org.python.python               0x0000000100000f14 0x100000000 + 3860

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x0000000100335a70  rcx: 0x0000000100300000  rdx: 0x0000000000000a00
  rdi: 0x0000000000000000  rsi: 0x00000001002f3254  rbp: 0x00007fff5fbff540  rsp: 0x00007fff5fbff470
   r8: 0x0000000100300000   r9: 0x0000000000000208  r10: 0x0002000000000003  r11: 0x0000000000000001
  r12: 0x0000000000000001  r13: 0x0000000000000007  r14: 0x00007fff5fbff500  r15: 0x00007fff5fbff480
  rip: 0x00000001002f2f97  rfl: 0x0000000000010206  cr2: 0x0000000000000000

Logical CPU:     1
Error Code:      0x00000004
Trap Number:     14


Binary Images:
       0x100000000 -        0x100000fff +org.python.python (2.7.5 - 2.7.5) <29DAB82B-5BC9-56CE-C09D-AE442FB37EF0> /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
       0x100003000 -        0x10016ffff +org.python.python (2.7.5, [c] 2004-2013 Python Software Foundation. - 2.7.5) <CDFB33CA-71DD-B1C2-5262-545F3FA06153> /Library/Frameworks/Python.framework/Versions/2.7/Python
       0x1002f1000 -        0x1002f3ff7 +readline.so (???) <6EA1FE1F-B78C-23EF-A4C2-9B7E9FB8B643> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so
       0x1004b0000 -        0x1004ceffb  libedit.2.dylib (39) <1B0596DB-F336-32E7-BB9F-51BF70DB5305> /usr/lib/libedit.2.dylib
       0x100600000 -        0x100654fe7 +libncursesw.5.dylib (5) <3F0079C0-01C1-3CB8-19CA-F9B49AA4F4A4> /Library/Frameworks/Python.framework/Versions/2.7/lib/libncursesw.5.dylib
    0x7fff6424d000 -     0x7fff6428068f  dyld (239) <7BD34028-A0FE-3543-955A-CEE43C7ECE2E> /usr/lib/dyld
    0x7fff8578a000 -     0x7fff8578eff7  libcache.dylib (62) <D991B21E-5F8F-38F1-91B3-5A3D13FA58D5> /usr/lib/system/libcache.dylib
    0x7fff8670f000 -     0x7fff86738ff7  libc++abi.dylib (47.1) <7926F072-A0C5-3753-A933-E871F3D26820> /usr/lib/libc++abi.dylib
    0x7fff86849000 -     0x7fff8684affb  libremovefile.dylib (33) <F34C9DC5-0F78-3AFC-9E93-D56E18666A96> /usr/lib/system/libremovefile.dylib
    0x7fff8684b000 -     0x7fff86852ff3  libcopyfile.dylib (103) <20F0240D-10F5-3554-8407-D8F3F77E3402> /usr/lib/system/libcopyfile.dylib
    0x7fff86853000 -     0x7fff8686fff7  libsystem_kernel.dylib (2422.1.43) <94EC865E-353C-308C-9C57-92FF7576FCDE> /usr/lib/system/libsystem_kernel.dylib
    0x7fff86a44000 -     0x7fff86a47ff7  libdyld.dylib (239) <44B9011B-DD63-315D-868C-382D082DEE4F> /usr/lib/system/libdyld.dylib
    0x7fff87667000 -     0x7fff8768aff7  libxpc.dylib (300.1.9) <306436DD-2569-3978-87ED-4EA0366E8331> /usr/lib/system/libxpc.dylib
    0x7fff8768b000 -     0x7fff87695fff  libcommonCrypto.dylib (60049) <977DD9FF-99BE-3B0E-9FCD-98EF44DB20F8> /usr/lib/system/libcommonCrypto.dylib
    0x7fff87696000 -     0x7fff876c5fd2  libsystem_m.dylib (3047.15) <181C338F-3C54-3F0E-A31B-9BDAF8657F5C> /usr/lib/system/libsystem_m.dylib
    0x7fff878cc000 -     0x7fff878cdff7  libsystem_blocks.dylib (63) <4E91F9EA-A4E4-3CDD-BC81-D240BA0C29A4> /usr/lib/system/libsystem_blocks.dylib
    0x7fff882f1000 -     0x7fff882f3ff7  libquarantine.dylib (71) <77210EBF-21F4-390C-8498-FDC5C90D1B3D> /usr/lib/system/libquarantine.dylib
    0x7fff88937000 -     0x7fff88aefff7  libicucore.A.dylib (511.22) <F9F35D66-9773-3D60-B85E-16B507F91D63> /usr/lib/libicucore.A.dylib
    0x7fff8a004000 -     0x7fff8a00bff7  libsystem_pthread.dylib (53.1.2) <6FFC74A2-9AA7-3D61-8064-50119D8176E7> /usr/lib/system/libsystem_pthread.dylib
    0x7fff8a00d000 -     0x7fff8a00effb  libSystem.B.dylib (1197.1.1) <0F46AD54-E26B-340A-A26D-37086FBF7B57> /usr/lib/libSystem.B.dylib
    0x7fff8a328000 -     0x7fff8a329ff7  libDiagnosticMessagesClient.dylib (100) <4CDB0F7B-C0AF-3424-BC39-495696F0DB1E> /usr/lib/libDiagnosticMessagesClient.dylib
    0x7fff8a34c000 -     0x7fff8a366fff  libdispatch.dylib (339.1.5.0.1) <A523C102-8356-30D5-A189-B712A267BF28> /usr/lib/system/libdispatch.dylib
    0x7fff8af35000 -     0x7fff8af65fff  libncurses.5.4.dylib (42) <BF763D62-9149-37CB-B1D2-F66A2510E6DD> /usr/lib/libncurses.5.4.dylib
    0x7fff8b0a6000 -     0x7fff8b0a7ff7  libsystem_sandbox.dylib (278.5) <DDA98EB2-A333-39C4-B7C8-0947BF0619B4> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff8b10a000 -     0x7fff8b2eefff  com.apple.CoreFoundation (6.9 - 847.11) <40C0F570-BBC0-3E9D-A83B-3E4083EA139E> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff8c8b4000 -     0x7fff8c8b9ff7  libunwind.dylib (35.3) <E152AFEA-2133-3AF3-A3B8-BF7CFD3E05F5> /usr/lib/system/libunwind.dylib
    0x7fff8c9b2000 -     0x7fff8cb5ff8f  libobjc.A.dylib (551) <AD54B900-1384-3C07-AA2A-F7E6A03F0181> /usr/lib/libobjc.A.dylib
    0x7fff8cb68000 -     0x7fff8cb8fffb  libsystem_info.dylib (449.1.2) <B285AAF5-3046-37C2-A1F9-8042EC3F6B2E> /usr/lib/system/libsystem_info.dylib
    0x7fff8cfcb000 -     0x7fff8d019fff  libcorecrypto.dylib (161.1) <F3973C28-14B6-3006-BB2B-00DD7F09ABC7> /usr/lib/system/libcorecrypto.dylib
    0x7fff8d8a1000 -     0x7fff8d8b2ff7  libsystem_asl.dylib (217.1.1) <4B431390-9A03-3E03-9490-B5CA977BE1ED> /usr/lib/system/libsystem_asl.dylib
    0x7fff8ea2e000 -     0x7fff8ea30ff3  libsystem_configuration.dylib (596.5) <D36BC3FC-78CF-33D4-910B-6BC0FC2061C7> /usr/lib/system/libsystem_configuration.dylib
    0x7fff8f21c000 -     0x7fff8f223fff  libcompiler_rt.dylib (35) <FBA11D1C-ECD2-3D8E-8260-BF8A6C83E5A1> /usr/lib/system/libcompiler_rt.dylib
    0x7fff8f533000 -     0x7fff8f53bfff  libsystem_dnssd.dylib (522.1.9) <7F7B0B2B-8416-3E13-A482-388362AC6BA7> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff905a3000 -     0x7fff905caff7  libsystem_network.dylib (241.3) <15FA3EBF-DC43-33D8-AFFB-B45355E806B5> /usr/lib/system/libsystem_network.dylib
    0x7fff9129a000 -     0x7fff9129dff7  libsystem_stats.dylib (93.1.15.1.3) <763D8C3A-D56A-3198-8EB8-5A1F1C93AC45> /usr/lib/system/libsystem_stats.dylib
    0x7fff91455000 -     0x7fff91466ff7  libz.1.dylib (53) <42E0C8C6-CA38-3CA4-8619-D24ED5DD492E> /usr/lib/libz.1.dylib
    0x7fff914ef000 -     0x7fff914f6ffb  liblaunch.dylib (842.1.1) <B6FB3F53-9F4A-32AF-9B11-EEFFC6C2B1C4> /usr/lib/system/liblaunch.dylib
    0x7fff91529000 -     0x7fff9152afff  libunc.dylib (28) <29F4D08C-F997-3EF6-A487-382925450C4B> /usr/lib/system/libunc.dylib
    0x7fff91a4c000 -     0x7fff91a9efff  libc++.1.dylib (120) <0CD61156-DCA0-3221-9CB7-A01695DE1D39> /usr/lib/libc++.1.dylib
    0x7fff92230000 -     0x7fff92272ff7  libauto.dylib (185.5) <4E107C53-8F50-3B87-B7A9-FE60FFA13FE1> /usr/lib/libauto.dylib
    0x7fff9227f000 -     0x7fff92288ff3  libsystem_notify.dylib (121) <9D7C2C0E-BC86-3C49-BD3D-E71C916090DB> /usr/lib/system/libsystem_notify.dylib
    0x7fff929c0000 -     0x7fff929c6ff7  libsystem_platform.dylib (24.1.3) <8C53550A-3B73-3DC9-85D7-92BEC13BB637> /usr/lib/system/libsystem_platform.dylib
    0x7fff92af7000 -     0x7fff92b80ff7  libsystem_c.dylib (997.1.1) <6A5FE5FF-3EB3-3DAC-9259-905142C78408> /usr/lib/system/libsystem_c.dylib
    0x7fff92bcd000 -     0x7fff92bd2fff  libmacho.dylib (845) <BE27F72F-D217-3116-A1CA-D07BA6AE30F9> /usr/lib/system/libmacho.dylib
    0x7fff92d76000 -     0x7fff92d76ff7  libkeymgr.dylib (28) <2F44F81F-0315-35BD-A97B-25743509CEC4> /usr/lib/system/libkeymgr.dylib
    0x7fff92d77000 -     0x7fff92d92ff7  libsystem_malloc.dylib (23.1.7) <C7493811-CC98-351C-A44A-1EC4C223E2BC> /usr/lib/system/libsystem_malloc.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 65487
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=75.1M resident=40.5M(54%) swapped_out_or_unallocated=34.6M(46%)
Writable regions: Total=27.7M written=2232K(8%) resident=2556K(9%) swapped_out=0K(0%) unallocated=25.2M(91%)

REGION TYPE                      VIRTUAL
===========                      =======
Kernel Alloc Once                     4K
MALLOC                             19.4M
MALLOC (admin)                       16K
STACK GUARD                        56.0M
Stack                              8192K
VM_ALLOCATE                           8K
__DATA                             1408K
__LINKEDIT                         64.4M
__TEXT                             10.7M
__UNICODE                           544K
shared memory                         4K
===========                      =======
TOTAL                             160.4M
4

2 回答 2

32

Running the following command on terminal, I got it working (Considering you're using python 3.3. Otherwise, change for the version you want):

cd /Library/Frameworks/Python.framework/Versions/3.3
cd ./lib/python3.3/lib-dynload 
sudo mv readline.so readline.so.disabled
于 2013-11-13T00:31:18.437 回答
9

您需要安装Python 2.7.6,其中包含对您遇到的错误的修复(OS X 10.9 上的交互式提示崩溃)。

于 2013-11-13T17:39:11.947 回答