Raspberry Pi Zero上的Python非法指令 [英] Python Illegal instruction on Raspberry Pi Zero
问题描述
当我尝试运行python脚本时,我得到了Illegal instruction
,仅此而已,它没有提供更多详细信息,所以我不知道发生了什么,是否有办法找出导致sudo
运行代码,但没有得到任何输出,程序仅退出.
更新:
我正在运行的脚本是bluez的simple-agent
脚本:
https://github.com/pauloborges/bluez/blob/master/测试/简单代理
此外,我像 @buratino 这样一行一行地运行,第二行出现了错误:>
from gi.repository import GObject
像 @Notlikethat 所说,Illegal instruction
当正在执行的代码针对其他体系结构进行编译时,Raspberry Pi使用ARM.
也就是说,我发现GObject似乎是引起问题的原因.无论如何,我卸载了已安装的每个与蓝牙相关的软件包,并使用raspbian存储库重新安装了它们,现在Illegal instruction
消失了,脚本可以正确执行.
为什么会这样?嗯,我有一个Raspberry Pi Zero,这意味着我没有以太网端口,在我购买WiFi加密狗之前,我先通过下载一些软件包来安装它们.计算机,并将.deb存储在SD卡中,当然,这意味着我必须手动检查我是否下载了正确版本的软件包,我一定把其中一个弄乱了.
经验教训,切勿尝试手动安装软件包,让apt-get
完成所有工作!
When I try to run a python script I get Illegal instruction
and that's it, it doesn't give any more details so I have no idea what's going on, is there a way to find out what is causing the Illegal instruction
error?
Also, I run the code using sudo
I don't get any output, the program just exits.
UPDATE:
The script I'm running is the simple-agent
script from bluez:
https://github.com/pauloborges/bluez/blob/master/test/simple-agent
Also, I ran line by line like @buratino said and I got the error in the second line:
from gi.repository import GObject
Like @Notlikethat said, the Illegal instruction
error happens when the code being executed was compiled for a different architecture, Raspberry Pi uses ARM.
That said, I found out that GObject seemed to be causing the problem. Anyway, I uninstalled every bluetooth related package I had installed and reinstall them using the raspbian repository and now the Illegal instruction
is gone and the script executes correctly.
Why did this happen? Well, I have a Raspberry Pi Zero which means I don't have an Ethernet port, before I bought a WiFi dongle I installed a few packages by downloading them on my computer and storing the .deb in the SD card, of course this means I have to manually check that I'm downloading the right version of the package, I must've messed up in one of them.
Lesson learned, never try to manually install packages, let apt-get
do all the work!
这篇关于Raspberry Pi Zero上的Python非法指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!