🔧 系统要求

  • Android:需安装 Android Studio
  • Linux/macOS:Python 3.7+ 环境
  • Windows:Visual Studio 2019 或更高版本

📥 安装方式

  1. 通过 pip 安装

    pip install tflite-runtime
    

    ✅ 适用于快速开发,支持 Python 3.7-3.10

  2. 下载预编译库

  3. 从源码编译
    🧱 执行以下命令:

    git clone https://github.com/tensorflow/tensorflow.git
    cd tensorflow
    ./configure
    bazel build //tensorflow/lite:libtensorflowlite.so
    

🧪 验证安装
运行示例代码:

import tensorflow as tf
interpreter = tf.lite.Interpreter(model_path="model.tflite")
interpreter.allocate_tensors()

📌 注意:确保已安装 TensorFlow 基础库

TensorFlow_Lite

🔗 扩展阅读TensorFlow Lite 入门教程