cx_Freeze - opencv compatibility

后端 未结 2 567
执念已碎
执念已碎 2021-01-22 11:32

I get a numpy.core.multiarray failed to import error whenever I try to build an exe file using cx_Freeze.

My system uses the following versions:

相关标签:
2条回答
  • 2021-01-22 12:03

    If this can help you, I managed to make a working example under Linux using SimpleCV with the following configuration:

    python 2.7.12
    SimpleCV 1.3
    numpy 1.11.0
    cx_Freeze 5.1.1

    The example code cv2_example.py is:

    import encodings
    import cv2
    print cv2.__version__
    i = 333
    print i
    

    The setup script setup.py is:

    from cx_Freeze import setup, Executable
    
    build_exe_options = {'packages': ['numpy']}
    
    exe = Executable(script='cv2_example.py', base=None)
    
    setup(name='cv2_example',
          version='1.0',
          executables=[exe],
          options={'build_exe': build_exe_options})
    

    I guess this example could work also for your configuration with python 3.6.0 and numpy 1.11.0 provided you upgrade cx_Freeze to version 5.1.1.

    0 讨论(0)
  • 2021-01-22 12:09

    I managed to make this work only after I uninstalled cx_Freeze and installed Pyinstaller instead. It works like a charm.

    0 讨论(0)
提交回复
热议问题