我正在尝试开发用于音频指纹处理的Flutter应用程序。我正在使用Starflut进行python集成。这是简单的示例:

//python file for using from dart

def tt(a,b) :
    print (a, b)
    return 666,777
g1 = 123
def yy(a,b,z) :
    print(a,b,z)
    return {'jack': 4098, 'sape': 4139}

class Multiply :

    def __init__(self):
        pass

    def multiply(self, a,b):
        print("multiply....",a,b)
        return a * b
//dart code which uses python

void _initStarCore() async {
    StarCoreFactory starcore = await Starflut.getFactory();
    StarServiceClass service = await starcore.initSimple("test", "123", 0, 0, []);
    srvGroup = await service["_ServiceGroup"];
    bool isAndroid = await Starflut.isAndroid();
    if (isAndroid == true) {
        String libraryDir = await Starflut.getNativeLibraryDir();
        String docPath = await Starflut.getDocumentPath();
        if (libraryDir.indexOf("arm64") > 0) {
            Starflut.unzipFromAssets("lib-dynload-arm64.zip", docPath, true);
        } else if (libraryDir.indexOf("x86_64") > 0) {
            Starflut.unzipFromAssets("lib-dynload-x86_64.zip", docPath, true);
        } else if (libraryDir.indexOf("arm") > 0) {
            Starflut.unzipFromAssets("lib-dynload-armeabi.zip", docPath, true);
        } else {
            Starflut.unzipFromAssets("lib-dynload-x86.zip", docPath, true);
        }
        await Starflut.copyFileFromAssets("python3.6.zip",
            "flutter_assets/starfiles", null);
    }
    await srvGroup.initRaw("python36", service);

    String resPath = await Starflut.getResourcePath();
    srvGroup.loadRawModule("python", "",
        resPath + "/flutter_assets/starfiles/" + "testpy.py", false);

    dynamic python = await service.importRawContext("python", "", false, "");

    StarObjectClass retobj = await python.call("tt", ["hello ", "world"]);
    print(await retobj[0]);
    print(await retobj[1]);

    print(await python["g1"]);

    StarObjectClass yy = await python.call("yy", ["hello ", "world", 123]);
    print(await yy.call("__len__",[]));

    StarObjectClass multiply = await service.importRawContext("python", "Multiply", true, "");
    StarObjectClass multiply_inst = await multiply.newObject(["", "", 33, 44]);
    print(await multiply_inst.getString());

    print(await multiply_inst.call("multiply", [11, 22]));

    await srvGroup.clearService();
    await starcore.moduleExit();
}

现在,我需要导入python库Dejavu进行音频指纹识别,但是我不知道该怎么做。 starflut文档中没有关于它的任何内容,也不存在其存储库中的问题。

有人遇到过同样的问题吗?或者,也许有人对我如何尝试解决问题有任何建议?

对不起,很抱歉,希望文本是可以理解的:)英语不是我的母语。

最佳答案

您阅读 repo 文件readmeinstallation readme文件了吗?

如果没有,请尝试以下操作:

在命令提示符下:

pip install PyDejavu

在需要导入Dejavu的模块中:
from dejavu import Dejavu

10-04 23:42