4
MacBook-Air:~ sgarza62$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 1 % 10
1
>>> 10 % 1
Segmentation fault: 11
模运算也会发生,如1 % 1
和2 % 2
。为什么在Python解释器中使用modulo时会出现分段错误?
在这台机器上运行Mac OS 10.9.2。
这似乎是操作系统(或构建)具体。仅供参考:它在linux2上的python2.7 [GCC 4.8.1]上正常工作。 – Hyperboreus
发现它:http://stackoverflow.com/questions/19531969/segmentation-fault-11-in-os-x – Hyperboreus
@Hyperboreus啊,你是对的。我没有意识到,第二个命令总是出现seg断层。感谢您的支持! – sgarza62