pyinstaller --add-binary 后如何使用捆绑程序? [英] how to use bundled program after pyinstaller --add-binary?
本文介绍了pyinstaller --add-binary 后如何使用捆绑程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 pyinstaller 制作可执行文件,方法如下:
I am trying to make an executable with pyinstaller, by issuing something like this:
pyinstaller -F --add-binary="sometool.exe:."myapp.py
构建工作正常.但是,如果我尝试执行以下操作:
The build works fine. But, if I try to do something like:
os.popen('sometool.exe')
,错误是没有找到.
那么,我该怎么做?
推荐答案
For Unix like machine
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
或用于 Windows
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
官方文档:https://pyinstaller.readthedocs.io/en/stable/usage.html
我花了几个小时来弄清楚如何使用 --add-binary
并最终让它工作起来.看--add-binary="libcrypto.dll:lib"
,必须加上:lib
作为后缀.
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.
这篇关于pyinstaller --add-binary 后如何使用捆绑程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文