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

Android Studio中通过Chaquopy安装Python包lmdb失败求助

求助:Chaquopy安装Python包lmdb失败问题

我在Android Studio项目中尝试通过Chaquopy安装Python包lmdb时遇到困难,希望能得到帮助。若我提供的信息不足,请告知需要补充的方向。

包相关说明

  • lmdb是Python与C语言混合编写的包,并非纯Python实现
  • Windows环境下用pip安装需C++编译器,也可通过wheel文件安装
  • Chaquopy不支持通过conda安装该包

尝试过的操作

  • 使用lmdb的wheel文件安装(项目构建/同步正常,但运行报错)
  • 额外安装patch-ng包
  • 自行创建仅包含patch_ng.py文件的patch_ng包

错误信息

ModuleNotFoundError: No module named 'patch_ng'

应用级build.gradle配置

android {
    compileSdk 32

    defaultConfig {
        applicationId "<name>"
        minSdk 21
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        ndk {
            abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
        }

        python {
            version "3.8"

            buildPython "<path_to_anaconda>\\anaconda3\\python.exe"

            pip{
                // install "patch-ng"
                // install ".\\src\\main\\python\\patch_ng"
                // BOTH FOLLOWING LINES DID NOT WORK FOR ME ( TRIED ONE AFTER THE OTHER)
                install  "lmdb"
                install "libs\\lmdb-1.3.0-cp310-cp310-win_amd64.whl"
            }

            pip {
                install "scipy"
                install "requests==2.24.0"
                install "numpy"
                install "pandas"
                //install "paddleocr"
            }
        }

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.27 15:02:11