pandas 我可以在 Android 上运行 Numpy(或其他 Python 包)吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39533680/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I run Numpy (or other Python packages) on Android?
提问by Bence
I have implemented a python script, which imports Numpy and Pandas and I would like to run this script on Android. To be more precise, I would like to embed this script into an application.
I would like to know whether it is possible? If so, what are the best-practices to implement it?
I would greatly appreciate any help!
我已经实现了一个 python 脚本,它导入了 Numpy 和 Pandas,我想在 Android 上运行这个脚本。更准确地说,我想将此脚本嵌入到应用程序中。
我想知道是否可以?如果是这样,实施它的最佳做法是什么?
我将不胜感激任何帮助!
回答by LinkBerest
If you do not want to build a website or app and have Python/Pandas running as a backend. You can use Kivyas a packager to run Pythonon Android. Further, if you check out the answer to this questionit points to the documentation for using numpy too - which is to use a "recipe" for compilation.
如果您不想构建网站或应用程序并将 Python/Pandas 作为后端运行。您可以使用Kivy作为打包器在 Android上运行 Python。此外,如果您查看此问题的答案,它也指向使用 numpy 的文档 - 即使用“配方”进行编译。
If using Kivy and not using a pure python library - these recipes will need to be used or created if they do not exist. So with Pandas, you would need to build this recipe yourself. Even if you do build this resource, the size of trying to load Pandas (not to include the resources it can require when performing analysis on dataframes) might be a bottleneck if trying to include it directly in the app and it still might be better to do this in a backend situation.
如果使用 Kivy 而不是使用纯 python 库 - 如果这些配方不存在,则需要使用或创建它们。因此,对于 Pandas,您需要自己构建此配方。即使您确实构建了此资源,尝试加载 Pandas 的大小(不包括在对数据帧执行分析时可能需要的资源)也可能是一个瓶颈,如果尝试将其直接包含在应用程序中,并且仍然可能更好在后端情况下执行此操作。