sofdigital / DroidPython

Python app development with SL4A in Android Studio
MIT License
55 stars 17 forks source link

How to add new python package #5

Closed tzupingkao closed 8 years ago

tzupingkao commented 8 years ago

I download numpy ( compiled for ARM use ) and wish to add it in SL4A project. Could you tell me how to add the "numpy files" dir into corresponded *.zip?

As my test result, I can not import numpy successfully.

michaelrinderle commented 8 years ago

You'll want to unzip the modules zip, add package and re-zip.

/apk-2.7/app/src/main/res/raw/python_extras_27.zip

In the zip archive, you'll put your package into this directory:

/packages/python/

To save on space you can run your package directory against python -m compileall and remove all the .py files before you put into the archive as well. Otherwise, you have useless .py files once the package is compiled for the first time on the device.

IqoqoService commented 6 years ago

@tzupingkao Did you manage to add numpy? Which files did you copy and did you have to add any dependencies?

Thanks

michaelrinderle commented 6 years ago

I'm pretty sure numpy has c binary dependencies, you'd need to get numpy source and compile for arm with android-ndk.