You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

树莓派3B Bullseye系统安装picframe时pi-heif编译失败求助

树莓派Bookworm系统安装pi-heif编译失败求助

我是树莓派新手,正在搭建电子相框,遇到了pi-heif wheel无法编译的问题。我的环境是Python3.11.2,已经安装了最新版libheif库,也完成了所有必要的前置操作:

  • sudo apt-get update
  • python3 -m pip install -U pip

查阅pi-heif和pillow-heif的文档后,没找到替代安装选项或故障排查方案。执行python3 -m pip install pi-heif或其他变体命令时,都会收到以下错误:

error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1
ERROR: Failed building wheel for pi-heif

我注意到piwheels上显示pi-heif在Bookworm系统编译失败,但看到不少用户在树莓派上用picframe,想问问有没有人遇到过类似问题,或者成功在树莓派上安装了pi-heif?任何建议都非常感谢!

完整错误输出:

bash ~ $python3 -m pip install pi-heif
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pi-heif
  Using cached pi_heif-0.20.0.tar.gz (16.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pillow>=10.1.0 in ./vene/lib/python3.11/site-packages (from pi-heif) (11.0.0)
Building wheels for collected packages: pi-heif
  Building wheel for pi-heif (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pi-heif (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [46 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build/lib.linux-armv7l-cpython-311/pi_heif
      copying pi_heif/constants.py -> build/lib.linux-armv7l-cpython-311/pi_heif
      copying pi_heif/heif.py -> build/lib.linux-armv7l-cpython-311/pi_heif
      copying pi_heif/_deffered_error.py -> build/lib.linux-armv7l-cpython-311/pi_heif
      copying pi_heif/misc.py -> build/lib.linux-armv7l-cpython-311/pi_heif
      copying pi_heif/AvifImagePlugin.py -> build/lib.linux-armv7l-cpython-311/pi_heif
      copying pi_heif/options.py -> build/lib.linux-armv7l-cpython-311/pi_heif
      copying pi_heif/HeifImagePlugin.py -> build/lib.linux-armv7l-cpython-311/pi_heif
      copying pi_heif/as_plugin.py -> build/lib.linux-armv7l-cpython-311/pi_heif
      copying pi_heif/_lib_info.py -> build/lib.linux-armv7l-cpython-311/pi_heif
      copying pi_heif/_version.py -> build/lib.linux-armv7l-cpython-311/pi_heif
      copying pi_heif/__init__.py -> build/lib.linux-armv7l-cpython-311/pi_heif
      running build_ext
      Looking for `libheif` using pkg-config.
      Checking for include file 'heif.h' in '/usr/include/arm-linux-gnueabihf'
      Checking for include file 'heif.h' in '/usr/include/arm-linux-gnueabihf/libheif'
      Found 'heif.h' in '/usr/include/arm-linux-gnueabihf/libheif'
      building '_pi_heif' extension
      creating build/temp.linux-armv7l-cpython-311/pi_heif
      arm-linux-gnueabihf-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/arm-linux-gnueabihf -I/usr/include -I/home/serbu/vene/include -I/usr/local/include -I/home/serbu/vene/include -I/usr/include/python3.11 -c pi_heif/_pi_heif.c -o build/temp.linux-armv7l-cpython-311/pi_heif/_pi_heif.o -Ofast -Werror
      pi_heif/_pi_heif.c: In function ‘_CtxAuxImage’:
      pi_heif/_pi_heif.c:760:21: error: implicit declaration of function ‘heif_image_handle_get_preferred_decoding_colorspace’ [-Werror=implicit-function-declaration]
        760 |     if (check_error(heif_image_handle_get_preferred_decoding_colorspace(aux_handle, &colorspace, &chroma))) {
            |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      pi_heif/_pi_heif.c:760:21: error: incompatible type for argument 1 of ‘check_error’
        760 |     if (check_error(heif_image_handle_get_preferred_decoding_colorspace(aux_handle, &colorspace, &chroma))) {
            |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            |                     |
            |                     int
      pi_heif/_pi_heif.c:14:35: note: expected ‘struct heif_error’ but argument is of type ‘int’
         14 | int check_error(struct heif_error error) {
            |                 ~~~~~~~~~~~~~~~~~~^~~~~
      pi_heif/_pi_heif.c: In function ‘_get_aux_type’:
      pi_heif/_pi_heif.c:1310:5: error: implicit declaration of function ‘heif_image_handle_release_auxiliary_type’; did you mean ‘heif_image_handle_free_auxiliary_types’? [-Werror=implicit-function-declaration]
       1310 |     heif_image_handle_release_auxiliary_type(aux_handle, &aux_type_c);
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            |     heif_image_handle_free_auxiliary_types
      pi_heif/_pi_heif.c: In function ‘_load_file’:
      pi_heif/_pi_heif.c:1510:21: error: incompatible types when assigning to type ‘struct heif_error’ from type ‘int’
       1510 |             error = heif_image_handle_get_preferred_decoding_colorspace(handle, &colorspace, &chroma);
            |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      cc1: all warnings being treated as errors
      error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pi-heif
Failed to build pi-heif
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pi-heif)

内容的提问来源于stack exchange,提问作者Sandra Serbu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 07:57:34