我使用Pyinstaller进行跨平台项目,并且希望隐藏"子目录中的所有库文件(.so / .dll),以便更容易找到可执行文件(现在.so / .dll文件列表很长,以至于我们已经收到了来自用户的反馈找不到它!)
如何修改我的.spec文件以将所有.so / .dll文件放在子目录中?
(由于其他一些原因,我不想使用--one-file
)
这就是我的.spec文件对gnu / linux的看法(文件类似于macos和windows):
# -*- mode: python -*-
block_cipher = None
import os
cwd_str = os.getcwd()
a = Analysis(['mindfulness-at-the-computer.py'],
pathex=[cwd_str],
binaries=[],
datas=[('./README.md', '.'), ('./LICENSE.txt', '.')],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
user_files_dir_str = "user_files"
a.datas += Tree('./' + user_files_dir_str, prefix=user_files_dir_str, excludes=['*.db'])
icons_dir_str = "icons"
a.datas += Tree('./' + icons_dir_str, prefix=icons_dir_str)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='mindfulness-at-the-computer',
debug=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='mindfulness-at-the-computer')
感谢帮助和亲切的问候,Tord