如何在pyinstaller中使用UPX?
我在跟着文档走。
我已经下载了UPX。
我的文件如下所示:
import csv
import selenium
import pandas
print('Hello')然后我运行:
pyinstaller -F --upx-dir C:\Users\DD\Downloads\upx394w\upx394w\123\upx308w\upx.exe zz.spec这不会影响文件的大小。
你知道我怎么才能让它工作吗?
# -*- mode: python -*-
block_cipher = None
a = Analysis(['zz.py'],
pathex=['C:\\Users\\DA\\13\\14'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='zz',
debug=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=True )发布于 2017-12-15 04:54:44
需要指定UPX目录,而不是UPX可执行文件:
例如:
发布于 2019-09-26 13:48:57
添加新的答案,因为现在(2019年9月) PyInstaller似乎比当前的答案和评论更有帮助。
我看到了输出
在构建早期,如果UPX正常工作。
此外,我可以看到很多行输出,其中PyInstaller正在调用upx。
我没有具体说明
,但确实有
在我的
环境变量。
发布于 2019-10-08 03:43:37
除了GlennS的评论:确切地说,这种行为在
文档。因此,在这方面,这并不是一个未经记录的意外好处。
请参见
https://pyinstaller.readthedocs.io/en/v3.3.1/usage.html#using-upx
https://stackoverflow.com/questions/47730240
复制相似问题