Closed fisherjoe closed 4 years ago
Unfortunately - not easily.
For the moment at least, using Python modules with C components isn't a support configuration; it can be made to work, but it's not something we're actively supporting.
We've got build instructions for numpy; however, they aren't especially easy to use.
A big part of the problem is that the iOS build currently operates with fully static linked libraries - there's no dynamic loading of modules. This is historically because iOS didn't support dynamic linking; this limitation no longer exists, but we haven't updated the iOS patch to allow dynamic linking.
I have prebuilt frameworks for a lot of C extensions here: https://github.com/ColdGrub1384/Pyto. Feel free to use them.
OpenCV is easy to include in an iOS app because OpenCV officially supports iOS. We just have to link the OpenCV framework and build the Python C extension (without OpenCV itself, just PyInit_cv2
). Also the C extension doesn’t need to be updated, when we want to update OpenCV we just have to update the framework without the C extension. Here is the C extension object of OpenCV built for arm64: https://github.com/ColdGrub1384/opencv-contrib-ios.
There is some python code in my python file, such as: import cv2 import numpy as np import tensorflow as tf
How could I integrate numpy、tensorflow and opencv into sdk? Appreciate!