如何在pyinstaller中使用UPX? [英] How do I use UPX with pyinstaller?

查看:540
本文介绍了如何在pyinstaller中使用UPX?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在pyinstaller中使用UPX?

How do I use UPX with pyinstaller?

我正在关注文档。

我已经下载了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

此不会影响文件的大小。

This does not affect the size of the file.

有人知道我如何使它工作吗?

Any idea how I can get this to work?

# -*- 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 )


推荐答案

需要指定UPX目录,而不是UPX可执行文件:

The UPX directory, not UPX executable needs to be specified:

例如:

pyinstaller myfile.py --upx-dir = .. \upx391w -y --onefile

这篇关于如何在pyinstaller中使用UPX?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆