How do you resolve 'hidden imports not found!' warnings in pyinstaller for scipy?

前端 未结 1 1385
既然无缘
既然无缘 2020-12-03 18:56

I\'m working on using pyinstaller to create an .exe for a python program that uses pandas and sklearn. The pyinstaller process completes and produces the dist folder with th

相关标签:
1条回答
  • 2020-12-03 19:01

    You need to go into the hook-scipy.py (or create one) and have it look like this:

    from PyInstaller.utils.hooks import collect_submodules
    from PyInstaller.utils.hooks import collect_data_files
    hiddenimports = collect_submodules('scipy')
    
    datas = collect_data_files('scipy')
    

    then go into the hook-sklearn.metrics.cluster.py file and modify it to look like this:

    from PyInstaller.utils.hooks import collect_data_files
    
    hiddenimports = ['sklearn.utils.sparsetools._graph_validation',
                     'sklearn.utils.sparsetools._graph_tools',
                     'sklearn.utils.lgamma',
                     'sklearn.utils.weight_vector']
    
    datas = collect_data_files('sklearn')
    

    I do not know if this part is necessary but I also created a hook-sklearn.py file that looks like this:

    from PyInstaller.utils.hooks import collect_submodules
    hiddenimports = collect_submodules('sklearn')
    

    In the cmd I used pyinstaller test.py -F to create one file.

    Then it should work:

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