PyQt4.QtGui致命Python错误:非法指令

时间:2018-05-01 11:53:46

标签: python linux raspberry-pi pyqt4 raspbian

我试图在Raspbian OS上运行Python PyQt4程序,但它无法执行。在Windows上它工作正常。我发现导入QtGui时会发生错误。

对我来说奇怪的是,一些模块加载正常(PyQt4.QtCore),但是其他模块会引发错误并重新启动shell(PyQt4.QtGui,PYQt4.QtTest,PyQt4.QtHelp)。

以下是Python shell的错误:

>>> import PyQt4
>>> from PyQt4 import QtCore
>>> from PyQt4 import QtGui
Backend terminated (returncode: -4)
Fatal Python error: Illegal instruction

Current thread 0x76fc2010 (most recent call first):
  File "<frozen importlib._bootstrap>", line 222 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 914 in create_module
  File "<frozen importlib._bootstrap>", line 577 in module_from_spec
  File "<frozen importlib._bootstrap>", line 666 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 958 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 969 in _find_and_load
  File "<frozen importlib._bootstrap>", line 222 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1016 in _handle_fromlist
  File "<pyshell>", line 1 in <module>
  File "/usr/lib/python3/dist-packages/thonny/shared/thonny/backend.py", line 588 in execute_source
  File "/usr/lib/python3/dist-packages/thonny/shared/thonny/backend.py", line 427 in _execute_source_ex
  File "/usr/lib/python3/dist-packages/thonny/shared/thonny/backend.py", line 404 in _execute_source
  File "/usr/lib/python3/dist-packages/thonny/shared/thonny/backend.py", line 167 in _cmd_execute_source
  File "/usr/lib/python3/dist-packages/thonny/shared/thonny/backend.py", line 119 in handle_command
  File "/usr/lib/python3/dist-packages/thonny/shared/thonny/backend.py", line 97 in mainloop
  File "/usr/lib/python3/dist-packages/thonny/shared/backend_launcher.py", line 41 in <module>
Resetting ...
>>> 

首先我尝试更新设备......

sudo apt-get update
sudo apt-get dist-upgrade
sudo reboot

......但它没有解决问题。

所以我尝试重新安装python3和pyqt4,这也没有帮助。

sudo apt-get install --reinstall python3
sudo apt-get install --reinstall python3-pyqt4

如果我检查pyqt4模块,应该安装所有软件包。

sudo apt-cache show python3-pyqt4

Description: Python3 bindings for Qt4
 PyQt4 exposes the Qt4 API to Python3. The following modules are supported:
  * QtCore
  * QtDBus
  * QtGui
  * QtNetwork
  * QtXml
  * QtScript
  * QtSvg
  * QtTest
  * QtAssistant
  * QtOpenGL (in python3-pyqt4.qtopengl)
  * QtSql (in python3-pyqt4.qtsql)
  * phonon (in python3-pyqt4.phonon)
Description-md5: 54b67afe2dab0fdf3d94483cba3da06a

其他信息:

  • Raspberry Pi 3,ARMv7
  • OS:Linux raspberrypi 4.9.80-v7 +#1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU / Linux
  • Python版本:python3(3.5.3)
  • PyQt版本:pyqt4_4.11.4

0 个答案:

没有答案