首页 > 解决方案 > Kivy buildozer Pil/Pillow 错误

问题描述

最近有没有人能让 pil/pillow 在 Buildozer 上工作?它曾经适用于旧的 python-for-android 但不适用于任何人。

我目前正在使用 Kivy 完整的 VM 0.5、api 27、sdk 23、ndk 17c。

我已经尝试了将近 5 个月,但仍然没有运气,我尝试将 pil,Pillow 添加到 buildozer 要求中,但没有任何效果......我什至尝试从https://www.lfd.uci.edu/下载它gohlke/pythonlibs/#pil

任何帮助将不胜感激。

枕头错误:

ImportError: dlopen failed: cannot locate symbol "jsimd_h2v1_downsample" referenced by /PIL/_imaging.so"

错误:

ImportError: The _imaging C module is not installed

 _imaging C is 64 bit instead of 32 bit

编辑: 使用 p4a.branch=master

[INFO]:    Prebuilding Pillow for armeabi-v7a
[INFO]:    Pillow has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for Pillow[armeabi-v7a]
[INFO]:    Applying patch patches/fix-docstring.patch
[INFO]:    -> running patch -t -d /home/kivy/Desktop...(and 259 more)
[INFO]:    Applying patch patches/fix-setup.patch
[INFO]:    -> running patch -t -d /home/kivy/Desktop...(and 255 more)
[INFO]:    -> running touch /home/kivy/Desktop/PicApp/...(and 110 more)
[INFO]:    Prebuilding pyjnius for armeabi-v7a
[INFO]:    pyjnius has no prebuild_armeabi_v7a, skipping
[INFO]:    Applying patches for pyjnius[armeabi-v7a]
[INFO]:    Applying patch sdl2_jnienv_getter.patch
[INFO]:    -> running patch -t -d /home/kivy/Desktop...(and 264 more)
      [INFO]:    -> running touch /home/kivy/Desktop/PicApp/...(and 117 more)    
[INFO]:    Prebuilding android for armeabi-v7a
[INFO]:    android has no prebuild_armeabi_v7a, skipping
[INFO]:    -> directory context /home/kivy/Desktop/PicApp/.buildozer/android/platform/build/build/other_builds/android-python2-sdl2/armeabi-v7a__ndk_target_21/android
[INFO]:    <- directory context /home/kivy/Desktop/PicApp/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Prebuilding kivy for armeabi-v7a
[INFO]:    kivy has no prebuild_armeabi_v7a, skipping
[INFO]:    # Building recipes
[INFO]:    Building harfbuzz for armeabi-v7a
[INFO]:    -> directory context /home/kivy/Desktop/PicApp/.buildozer/android/platform/build/build/other_builds/harfbuzz/armeabi-v7a__ndk_target_21/harfbuzz
[INFO]:    -> running configure --without-icu --host...(and 161 more)
           working:  Documentation:  no                      [INFO]:    -> running make -j5
           working: [INFO]:    -> running cp -L src/.libs/libharfbuzz.a ...(and 85 more)
[INFO]:    <- directory context /home/kivy/Desktop/PicApp/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Building hostpython2 for armeabi-v7a
[INFO]:    -> directory context /home/kivy/Desktop/PicApp/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2
[INFO]:    -> directory context /home/kivy/Desktop/PicApp/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2/native-build
[INFO]:    -> running configure
           working: creating Ma[INFO]:    <- directory context /home/kivy/Desktop/PicApp/.buildozer/android/platform/build/build/other_builds/hostpython2/desktop/hostpython2
[INFO]:    -> running cp Modules/Setup.dist /home/ki...(and 127 more)
[INFO]:    -> running make -j 1 -C /home/kivy/Deskto...(and 104 more)
           working: copyin[INFO]:    <- directory context /home/kivy/Desktop/PicApp/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Building jpeg for armeabi-v7a
[INFO]:    -> directory context /home/kivy/Desktop/PicApp/.buildozer/android/platform/build/build/other_builds/jpeg/armeabi-v7a__ndk_target_21/jpeg
[INFO]:    -> running rm -f CMakeCache.txt CMakeFiles/
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/kivy/Desktop/PicApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 1081, in <module>
    main()
  File "/home/kivy/Desktop/PicApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 1075, in main
    ToolchainCL()
  File "/home/kivy/Desktop/PicApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 577, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/kivy/Desktop/PicApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 151, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/kivy/Desktop/PicApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 200, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "pythonforandroid/build.py", line 562, in build_recipes
  File "/home/kivy/Desktop/PicApp/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/recipes/jpeg/__init__.py", line 37, in build_arch
    shprint(sh.cmake, '-G', 'Unix Makefiles',
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 3349, in __getattr__
    return self.__env[name]
  File "/usr/local/lib/python2.7/dist-packages/sh.py", line 3226, in __getitem__
    raise CommandNotFound(k)
sh.CommandNotFound: cmake
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=PicApp --bootstrap=sdl2 --requirements=hostpython2,python2,kivy==master,plyer,android,Pillow --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/kivy/Desktop/PicApp/.buildozer/android/platform/build"

标签: pythonkivypython-imaging-librarybuildozer

解决方案


我之前遇到过这个错误,我卸载了枕头然后重新安装它对我有用

如果你使用 python3 用下面的 python3 替换 python

卸载

sudo python -m pip uninstall pillow

安装

sudo python -m pip install pillow

推荐阅读