joaoventura / pybridge

Reuse Python code in native Android applications
215 stars 56 forks source link

How to add the other libs to python #8

Closed 78226415 closed 6 years ago

78226415 commented 7 years ago

Hi there, As you known, the stdlib.zip contains the base libs for python, if you want to use another lib, NumPy e.g, you could get it from : https://github.com/numpy/numpy, then how to add it to python? Thanks.

yukilee01 commented 7 years ago

Hi there, I put numpy into stdlib.zip, it didn't work. Have you get the solution?

78226415 commented 7 years ago

No, i don't get the solution yet! I think it should be use toolchain to make it but i don't know how to make it. Any help should be appreciated!

Steven9402 commented 7 years ago

the same question, I tried to add sys path in bootstrap.py by import sys sys.path.append('/home/cuizhou/codes/AndroidStudioProjects/pybridge-master/app/src/main/assets/python/numpy.zip') but still did not work. when I print sys.path, I got /data/user/0/com.jventura.pyapp/assets/python /data/user/0/com.jventura.pyapp/assets/python/stdlibs.zip /home/cuizhou/codes/AndroidStudioProjects/pybridge-master/app/src/main/assets/python/numpy.zip so I think the solution is to add the numpy path properly. Can someone help to answer? Thanks!!!

joaoventura commented 6 years ago

Libraries that depend on C libraries, which I believe numpy does, are not trivial to compile as they have to be compiled against the crystax's python. I do not have a solution for numpy, sorry all..