添加单个文件到PyInstaller



我试图使用PyInstallerpyarmor。我使用pyarmors "super mode",它在我的模块的根创建pytransform.pyd

为了记录,我没有使用规范文件,相反,我正在用PyInstaller.__main__.run(args)做python。我不确定这是否有什么不同。

目录结构:

c:/dist/
module/
*.py  # Obfuscated code
data/
stuff.json
pytransform.pyd

我已经使用--add-data C:/dist/module;module--add-data C:/dist/data;data来包含大多数必要的文件,但是我正在努力使用pytransform.pyd

如果我使用--add-data C:/dist/pytransform.pyd;pytransform.pyd,我在运行构建的可执行文件时得到这个错误。它看起来像是假设它是一个目录。

pytransform.pydpytransform.pyd could not be extracted!
fopen: No such file or directory

如果我使用--add-binary C:/dist/pytransform.pyd;pytransform.pyd,我在构建时得到这个错误:

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Peter\AppData\Roaming\pyinstaller\bincache00_py37_64bit\pytransform.pyd\pytransform.pyd'

我检查了bincache文件夹,它实际上包含pytransform.pyd,所以它在那里。

我怎么能只添加一个文件到可执行文件?

使用--hidden-import=pytransform将其添加为隐藏导入时可以正常工作。

我仍然有兴趣知道为什么--add-data--add-binary不起作用。

最新更新