python - embed python into android - using c++ to call python source files

20 views Asked by At

I use NDK25 to compile Python3.11 source code, after compiling I put lib and lib-dynload into Android Studio for development,the embedded Python can be used normally, this is all the modules that have been included:

sys
builtins
_frozen_importlib
_imp
_thread
_warnings
_weakref
_io
marshal
posix
_frozen_importlib_external
time
zipimport
_codecs
codecs
encodings.aliases
encodings
encodings.utf_8
_signal
_abc
abc
io

Now can parse the python source file normally, that is,.py file, but can not import pip download module, always prompted that the module can not be found. I want to use Sqlite and Python third-party module, such as: requests, how should I operate?

I try: Download the module of requests through pip in shell, and put it into site-packages under AndroidStudio directory for use, indicating that the module cannot be found However, it is possible to find the module using adb shell in mobile phones.

Debugging Python code in Android Studio - Examples of using PyErr_Print, Py_DECREF, and other debug functions

0

There are 0 answers