我试图创建一个使用opencv作为后端的python应用程序,当我尝试使用pyinstaller
导出应用程序时出现问题,事实上,即使我使用的cv2函数非常少:
from cv2 import normalize, cvtColor, applyColorMap, imread, NORM_MINMAX, COLORMAP_JET, COLOR_BGR2RGB
每次我都是#pyinstall'结果文件夹的脚本很大(> 100mb)。这是因为pyinstaller
导入了整个opencv库:
libopencv_aruco.so.3.3 libopencv_dnn.so.3.3 libopencv_hdf.so.3.3 libopencv_objdetect.so.3.3 libopencv_rgbd.so.3.3 libopencv_text.so.3.3 libopencv_xphoto.so.3.3
libopencv_bgsegm.so.3.3 libopencv_face.so.3.3 libopencv_highgui.so.3.3 libopencv_optflow.so.3.3 libopencv_saliency.so.3.3 libopencv_tracking.so.3.3 cv2.so
libopencv_bioinspired.so.3.3 libopencv_features2d.so.3.3 libopencv_imgcodecs.so.3.3 libopencv_phase_unwrapping.so.3.3 libopencv_shape.so.3.3 libopencv_videoio.so.3.3
libopencv_calib3d.so.3.3 libopencv_flann.so.3.3 libopencv_img_hash.so.3.3 libopencv_photo.so.3.3 libopencv_stitching.so.3.3 libopencv_video.so.3.3
libopencv_ccalib.so.3.3 libopencv_freetype.so.3.3 libopencv_imgproc.so.3.3 libopencv_plot.so.3.3 libopencv_structured_light.so.3.3 libopencv_xfeatures2d.so.3.3
libopencv_core.so.3.3 libopencv_fuzzy.so.3.3 libopencv_ml.so.3.3 libopencv_reg.so.3.3 libopencv_surface_matching.so.3.3 libopencv_ximgproc.so.3.3
我使用的cv2组件非常少,是否可以只导入所需的组件?我已经尝试手动导入共享库,但当然它没有工作,因为它们没有 init 功能:
ImportError: dynamic module does not define init function (init__main__)
任何可以减少我的可交付成果的解决方案都将受到赞赏。