在树莓派Zero W上安装TensorFlow Lite(LiteRT)遇阻求方案
树莓派Zero W安装TensorFlow Lite Runtime(LiteRT)的替代方案
手动安装预编译ARMv6 wheel包
树莓派Zero W基于ARMv6架构,目前ai-edge-litert包暂未适配该架构,可改用官方维护的tflite-runtime预编译包:
- 检查当前Python版本:
python3 --version - 下载对应版本的ARMv6 wheel包(示例为Python 3.9):
wget https://github.com/google-coral/pycoral/releases/download/v2.0.0/tflite_runtime-2.5.0.post1-cp39-cp39-linux_armv6l.whl - 执行安装:
pip3 install tflite_runtime-2.5.0.post1-cp39-cp39-linux_armv6l.whl
若Python版本不同,可在PyCoral发布页找到对应wheel包。
源码编译安装
如果没有匹配的预编译包,可源码编译:
- 安装编译依赖:
sudo apt update && sudo apt install build-essential python3-dev git cmake bazel - 克隆TensorFlow仓库并切换到稳定分支:
git clone https://github.com/tensorflow/tensorflow.git cd tensorflow git checkout r2.15 - 配置编译环境(确认Python路径,其余选项默认即可):
./configure - 针对ARMv6架构编译:
bazel build --config=elinux_armhf //tensorflow/lite/python:tflite_runtime - 安装编译好的wheel包:
pip3 install bazel-bin/tensorflow/lite/python/tflite_runtime-*.whl
一键脚本安装
使用PyCoral的官方脚本自动适配安装:
curl https://raw.githubusercontent.com/google-coral/pycoral/master/scripts/install.sh | bash
内容的提问来源于stack exchange,提问作者gus
相关产品推荐
相关产品推荐

