树莓派上的“python"命令分段错误 [英] 'python' command segmentation fault on raspberry pi

查看:51
本文介绍了树莓派上的“python"命令分段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题相当简单:在运行 Raspbian Wheezy 的 raspberry pi 模型 A+ 上运行python"命令(不是脚本)会出现分段错误:

My problem is fairly simple: running the 'python' command (not a script) on my raspberry pi model A+ running Raspbian Wheezy gives a segmentation fault:

pi@raspberrypi ~ $ python
Segmentation fault

我在 python 脚本中发现了很多处理分段错误"的线程(通常与 外部 C 模块).其他一些更专门针对 raspberry pi 的人经常在 apt-get 升级期间谈到分段错误",涉及一个 python 模块(这里那里).

I found quite a number of threads dealing with 'segmentation fault' in python scripts (often related to external C modules). Some others more specifically on raspberry pi were often speaking of 'segmentation fault' during an apt-get upgrade, involving a python module (here or there).

但这些都没有回答我的问题.

But those are not answering my problem.

在 gdb 中运行它给出:

Running it in gdb gave:

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

我找到了这篇相关帖子,但是没有给出明确的解决方案.

I found this related post, but no clear solution is given.

最后一个元素:python3 工作正常.

Last element: python3 works just fine.

这里有人知道发生了什么吗?

Would anyone here have an idea of what is happening?

感谢您的帮助~

推荐答案

您在运行 Python 时从 GDB 收到的消息表明您尝试使用的 Python 可执行文件由于某种原因已损坏.尝试重新安装所有与 Python 相关的包:

The messages you’re getting from GDB when running Python suggest the Python executable you’re trying to use is for some reason corrupted. Try reinstalling all Python-related packages:

$ sudo apt-get install --reinstall `dpkg --get-selections | grep -E '^(lib)?python' | cut -f1 | cut -d: -f1`

这篇关于树莓派上的“python"命令分段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆