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

后端 未结 2 1365
情话喂你
情话喂你 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:31

    I add the same problem and solved it using fepzzz method and including some missing packages:

    additional_mods = ['numpy.matlib', 'multiprocessing.process']
    includefiles = [(r'C:\Anaconda3\Lib\site-packages\scipy')]
    
    setup(xxx, options={'build_exe': {'includes': additional_mods, 'include_files': includefiles}})
    

    And using version 5.0.2 of cx-Freeze package, which solved an error when importing multiprocessing.process

    0 讨论(0)
  • 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))
    
    0 讨论(0)
提交回复
热议问题