Pyinstaller- Including assets in executable

后端 未结 1 1477
无人及你
无人及你 2020-12-19 22:09

Cant figure out how to pack custom resources into my executable, i found this bit of info,https://groups.google.com/forum/#!msg/pyinstaller/HcTTyFlPJHA/kqd4wnm7JhkJ

相关标签:
1条回答
  • 2020-12-19 23:13

    Adding data files and next section using data files from module in pyinstaller docs.

    Yes, you should to use package relative path instead of plain relative in your code. Because package will be extracted not relative to execution binary, but somewhere in temp dir. Look for pkg_resources package. For example this function:

    dir = resource_filename('your_package', 'app/samples')
    

    To clarify how to define datas in spec look for example:

    a = Analysis(['../trunk/__main__.py']
             ...
             datas=[('../src/trunk/your_package/app/samples/data.bin', 'your_package/app/samples')],
             ...
    
    0 讨论(0)
提交回复
热议问题