Issues with pyinstaller and pyproj

前端 未结 3 1245
灰色年华
灰色年华 2020-12-18 07:29

I\'m trying to do an standalone application with pyinstaller. The executable has just build fine, but when I´m trying to do some operations with functions integrated on libr

相关标签:
3条回答
  • 2020-12-18 07:50
    from PyInstaller.hooks.hookutils import collect_data_files
     datas = collect_data_files('pyproj')
    
    • This didn't worked for me. There were some errors in the executable again.

    But I found in another thread that the problem can be solved with this:

    from mpl_toolkits.basemap import pyproj as pyproj
    

    pyinstaller seem to have problems to integrate the pyproj module itself, but basemap includes pyproj and is not ignored by pyinstaller.

    Just for update

    0 讨论(0)
  • 2020-12-18 08:00

    The problem is that when using pyproj with PyInstaller, pyproj can not find the data files that are in the library folder.

    The solution is to create a hook file, which will specify where the data files, so you can link them with our executable.

     hook-pyproj.py
    
     from PyInstaller.hooks.hookutils import collect_data_files
     datas = collect_data_files('pyproj')
    

    The hook file can be located on "hooks" folder on Pyinstaller installation or using the order --additional-hooks-dir, specifying a folder in which will be located "hook-pyproj.py"

    0 讨论(0)
  • 2020-12-18 08:11

    Just threading on the previous answer, since 2014 there has been some refactoring on PyInstaller and here is the correct import line for the hook file above :

    from PyInstaller.utils.hooks import collect_data_files
    datas = collect_data_files('pyproj')
    
    0 讨论(0)
提交回复
热议问题