Scipy and CX_freeze - Error importing scipy: you cannot import scipy while being in scipy source directory

后端 未结 2 1378
情话喂你
情话喂你 2020-12-11 17:03

I\'m having trouble compiling an exe while using cx_freeze and scipy. In particular, my script uses

from scipy.interpolate import griddata

2条回答
  •  甜味超标
    2020-12-11 17:49

    i have had the same issue. I added this code to the setup.py generated by cx_freeze:

    import scipy
    includefiles_list=[]
    scipy_path = dirname(scipy.__file__)
    includefiles_list.append(scipy_path)
    

    Then, used includefiles_list as part of the build_exe parameter:

    build_options = dict(packages=[], include_files=includefiles_list)
    
    setup(name="foo", options=dict(build_exe=build_options))
    

提交回复
热议问题