安装 python-rpi.gpio 时出现“EOFError:EOF 读取预期对象”

安装 python-rpi.gpio 时出现“EOFError:EOF 读取预期对象”

在全新安装 Raspbian Jessie (Raspberry pi 2) 时,第一次尝试升级时会出现错误:

Preparing to unpack .../python-rpi.gpio_0.6.1-1_armhf.deb ...
Traceback (most recent call last):
  File "/usr/bin/pyclean", line 31, in <module>
    from debpython import files as dpf
EOFError: EOF read where object expected
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
Traceback (most recent call last):
  File "/usr/bin/pyclean", line 31, in <module>
    from debpython import files as dpf
EOFError: EOF read where object expected
dpkg: error processing archive /var/cache/apt/archives/python-rpi.gpio_0.6.1-1_armhf.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 37, in <module>
    from debpython import files as dpf
EOFError: EOF read where object expected
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Preparing to unpack .../python3-rpi.gpio_0.6.1-1_armhf.deb ...
Unpacking python3-rpi.gpio (0.6.1-1) over (0.6.0a3-1) ...
Preparing to unpack .../raspi-config_20160108_all.deb ...
Unpacking raspi-config (20160108) over (20151117) ...
Preparing to unpack .../rc-gui_0.4-1_armhf.deb ...
Unpacking rc-gui (0.4-1) over (0.3-2) ...
Preparing to unpack .../sudo_1.8.10p3-1+deb8u3_armhf.deb ...
Unpacking sudo (1.8.10p3-1+deb8u3) over (1.8.10p3-1+deb8u2) ...
Preparing to unpack .../sonic-pi_1%3a2.9.0-1_armhf.deb ...
Unpacking sonic-pi (1:2.9.0-1) over (1:2.7.0-1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for systemd (215-17+deb8u2) ...
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Processing triggers for gnome-icon-theme (3.12.0-1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/python-rpi.gpio_0.6.1-1_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

看完之后看来问题出在 python-rpi.gpio 上。如何克服的问题。最重要的是,因为现在无法进行其他安装。

常见的建议如apt-get cleandpkg --configure -a不幸的是没有帮助。

ldconfig
/sbin/ldconfig.real: /usr/lib/arm-linux-gnueabihf/libatomic.so.1.1.0 is not an ELF file - it has the wrong magic bytes at the start.
/sbin/ldconfig.real: /usr/lib/arm-linux-gnueabihf/libatomic.so.1 is not an ELF file - it has the wrong magic bytes at the start.

除了降级到 Raspbian Wheezy 还能做什么?

答案1

实际原因是 SD 卡出现故障,删​​除功能未正确实现,在升级过程中删除也会更改其他文件。

答案2

手动获取sonic-pi并重试....

wget http://sonic-pi.net/files/releases/v2.9.0/Sonic-Pi-for-RPi-Jessie-v2.9.0.tgz
tar -xvzf Sonic-Pi-for-RPi-Jessie-v2.9.0.tgz

相关内容