我的问题很简单:在我的覆盆子pi模型上运行'python'命令(不是脚本)A +运行Raspbian Wheezy会出现分段错误:
pi@raspberrypi ~ $ python
Segmentation fault
我在python脚本中发现了很多处理“分段错误”的线程(通常与external C modules相关)。其他一些更具体的关于树莓派的人在apt-get升级期间经常谈到“分段错误”,涉及python模块(here或there)。
但那些人没有回答我的问题。
在gdb中运行它:
pi@raspberrypi ~ $ gdb python
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/python...BFD: /usr/bin/python: invalid string offset 4204450 >= 26547 for section `.dynstr'
BFD: /usr/bin/python: invalid string offset 34425 >= 26547 for section `.dynstr'
BFD: /usr/bin/python: invalid string offset 276647 >= 26547 for section `.dynstr'
...
(50 or so such lines later)
...
BFD: /usr/bin/python: invalid string offset 2340624285 >= 26547 for section `.dynstr'
(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/python
Program received signal SIGSEGV, Segmentation fault.
0xb6ff0124 in ?? () from /lib/ld-linux-armhf.so.3
(gdb) backtrace
#0 0xb6ff0124 in ?? () from /lib/ld-linux-armhf.so.3
#1 0xbefff358 in ?? ()
Cannot access memory at address 0x7a626964
我找到了this related post,但没有给出明确的解决方案。
最后一个元素:python3工作正常。
这里有人会知道发生了什么吗?
感谢您的帮助〜
答案 0 :(得分:1)
运行Python时从GDB获取的消息表明您尝试使用的Python可执行文件由于某种原因已损坏。尝试重新安装所有与Python相关的包:
$ sudo apt-get install --reinstall `dpkg --get-selections | grep -E '^(lib)?python' | cut -f1 | cut -d: -f1`