怎么压缩用python写的游戏的文件大小?或者用什么开发库?

怎么压缩用python写的游戏的文件大小?或者用什么开发库?,第1张

你可以尝试以下方法:

建立虚拟环境,减少Python打包额外的第三方库

使用upx和pyinstaller进行压缩

使用upx和nuitka进行压缩

这几种方法网上可以找到很多教程,都能够在一定程困此度上减小打包出来的文件配尺启大小,但是因为Python的解释型语言,除了使用nuitka编译成exe以外,其它培如的压缩方法作用一般不大,但是使用nuitka编译后的文件也会有较大的体积。

1、首轿丛先打开upx的相关窗口,将测试程序拖到如图所示的位置。

2、此时猛拿需要在选项枝帆搭窗口中根据实际情况设置相应的参数。

3、如果如果没问题,就继续确定执行。

4、最后当显示压缩进度为100%时,就可以达到目标。

upx [ *command* ] [ *options* ] *filename*...upx 命令辩做 参数 文件名COMMANDS 命令

Compress 压者粗缩 这是默认 *** 作,比如 “upx 文件名”就直接压缩文件了。

This is the default operation, eg. upx yourfile.exe will compress the

file specified on the command line.

Decompress 解压缩 “upx -d 文件名”

All UPX supported file formats can be unpacked using the -d switch, eg.

upx -d yourfile.exe will uncompress the file you've just compressed.

Test 测试 -t

The -t command tests the integrity of the compressed and uncompressed

data, eg. upx -t yourfile.exe check whether your file can be safely

decompressed. Note, that this command doesn't check the whole file, only

the part that will be uncompressed during program execution. This means

that you should not use this command instead of a virus checker.

List 列表 -l

The -l command prints out some information about the compressed files

specified on the command line as parameters, eg upx -l yourfile.exe

shows the compressed / uncompressed size and the compression ratio of

*yourfile.exe*.

OPTIONS 安静模式,不提示 -q 或非常安静模式 -qq 极安静模式 -qqq 帮助--help

-q: be quiet, suppress warnings

-q -q (or -qq): be very quiet, suppress errors

-q -q -q (or -qqq): produce no output at all

--help: prints the help

--version: print the version of UPX

其他携嫌衡很少用就不翻译了。常用的就是压缩:upx 文件名解压缩: upx -d 文件名


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12411488.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-25
下一篇 2023-05-25

发表评论

登录后才能评论

评论列表(0条)

保存