how to use bundled program after pyinstaller --add-binary?

前端 未结 2 691
半阙折子戏
半阙折子戏 2021-02-09 23:22

I am trying to make an executable with pyinstaller, by issuing something like this:

pyinstaller -F --add-binary=\"sometool.exe:.\" myapp.py

The b

2条回答
  •  不思量自难忘°
    2021-02-09 23:51

    For Unix like machine

    pyinstaller --noconfirm --log-level=WARN \
        --onefile --nowindow \
        --add-data="README:." \
        --add-data="image1.png:img" \
        --add-binary="libfoo.so:lib" \
        --hidden-import=secret1 \
        --hidden-import=secret2 \
        --upx-dir=/usr/local/share/ \
        myscript.spec
    

    Or for Windows

    pyinstaller --noconfirm --log-level=WARN ^
        --onefile --nowindow ^
        --add-data="README;." ^
        --add-data="image1.png;img" ^
        --add-binary="libfoo.so;lib" ^
        --hidden-import=secret1 ^
        --hidden-import=secret2 ^
        --icon=..\MLNMFLCN.ICO ^
        myscript.spec
    

    Official Doc: https://pyinstaller.readthedocs.io/en/stable/usage.html

    I spent hours to figure out how to use --add-binary and finally got it working. Look at --add-binary="libcrypto.dll:lib", you must add :lib as postfix.

提交回复
热议问题