吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 832|回复: 26
上一主题 下一主题
收起左侧

[原创工具] 一个简单的python语言的打包工具

  [复制链接]
跳转到指定楼层
楼主
Ar11223 发表于 2026-1-1 14:27 回帖奖励
作为一个没有经历过任何系统学习的编程小白,曾经的我一度为了打包python脚本而烦恼,在这个过程中也对这个有了一定的了解。
于是,在一个风和日丽的午后,我决定写一个用于python打包的小玩意。目前支持pyinstaller和nuitka这两种相对主流的打包方式。
这个界面很简单,选择你需要打包的脚本,会自动检测是不是在虚拟环境中,并检测一些依赖是否按转;当然了,还是可以使用自己手动选择相应的python解释器。
然后就是,图标制作。之前打包的python脚本只有一个默认的图标,后来慢慢学习了更改图标的方式。这里面的制作图标也许目前不是很完善,适配做到的可能还不是很好,但是勉强也可以使用吧。
后面就是检测脚本中的一些依赖,选择安装。这个地方其实有些鸡肋,一般自己写,肯定在虚拟环境中安装好了,但是可能需要选择另外的解释器进行编译,应该还是会使用到的。
后续的两种打包方式就是自己选择就行了。
隐藏控制台就是运行不会出现那个命令窗口,生成单文件就是没有别的文件夹了。
压缩这里有upx和不压缩,以及内压缩。注意双层压缩可能导致打包时间很长。
编译后端主要是对nuitka的,建议自己去安装下MSVC,这样使用起来速度快一点。
并行任务,这个看电脑的内存,一般不要选择自动。选择4即可。

当然了,毕竟我也是小白,很多地方写的不是很好,各位大佬海涵。github地址贴上:https://github.com/Ar11223/Python-script-packaging-tool.git
蓝奏云https://wwapx.lanzoul.com/ixmje3eysd9c
密码:2sab

image.png (28.48 KB, 下载次数: 0)

图标制作控制台

图标制作控制台

image.png (114.18 KB, 下载次数: 0)

UI界面

UI界面

image.png (23.68 KB, 下载次数: 0)

两种编译端口

两种编译端口

免费评分

参与人数 5吾爱币 +11 热心值 +5 收起 理由
ws001980 + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
chj070711 + 1 + 1 谢谢@Thanks!
Terri + 1 + 1 谢谢@Thanks!
zolt + 1 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
风之暇想 + 7 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

推荐
Terri 发表于 2026-1-1 19:46
依赖安装失败 什么情况  0.0

开始检测脚本依赖...检测到 1 个第三方依赖: PyQt5检查依赖: PyQt5... 未安装
缺失依赖: PyQt5安装依赖 (使用清华源): C:/Users/Administrator/PyCharmMiscProject\venv\Scripts\python.exe -m pip install PyQt5 -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cnLooking in indexes: https://pypi.tuna.tsinghua.edu.cn/simpleCollecting PyQt5  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ca/ac/596e8ca16fd0634542d874c0d79219fc527ea7de73a5000092f60ecbf6e9/PyQt5-5.15.10-cp37-abi3-win_amd64.whl (6.8 MB)Collecting PyQt5-Qt5>=5.15.2  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/37/97/5d3b222b924fa2ed4c2488925155cd0b03fd5d09ee1cfcf7c553c11c9f66/PyQt5_Qt5-5.15.2-py3-none-win_amd64.whl (50.1 MB)Collecting PyQt5-sip<13,>=12.13  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ee/81/fce2a475aa56c1f49707d9306b930695b6ff078c2242c9f2fd72a3214e1f/PyQt5_sip-12.13.0.tar.gz (123 kB)  Installing build dependencies: started  Installing build dependencies: finished with status 'done'  Getting requirements to build wheel: started  Getting requirements to build wheel: finished with status 'done'    Preparing wheel metadata: started    Preparing wheel metadata: finished with status 'done'Building wheels for collected packages: PyQt5-sip  Building wheel for PyQt5-sip (PEP 517): started  Building wheel for PyQt5-sip (PEP 517): finished with status 'error'  ERROR: Command errored out with exit status 1:   command: 'C:\Users\Administrator\PyCharmMiscProject\venv\Scripts\python.exe' 'C:\Users\Administrator\PyCharmMiscProject\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\ADMINI~1\AppData\Local\Temp\tmp9ftbhbqf'       cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-37i97tz7\PyQt5-sip  Complete output (5 lines):  running bdist_wheel  running build  running build_ext  building 'PyQt5.sip' extension  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/  ----------------------------------------  ERROR: Failed building wheel for PyQt5-sipFailed to build PyQt5-sipERROR: Could not build wheels for PyQt5-sip which use PEP 517 and cannot be installed directlyWARNING: You are using pip version 20.1.1; however, version 24.0 is available.You should consider upgrading via the 'C:\Users\Administrator\PyCharmMiscProject\venv\Scripts\python.exe -m pip install --upgrade pip' command.安装依赖 PyQt5 失败,退出码: 1
安装完成: 0/1 成功, 失败: PyQt5以下依赖安装失败: PyQt5
推荐
qq1088 发表于 2026-1-1 18:48
有些打包的依赖不会自动安装,终端可以自己输入就好了
沙发
lx136648 发表于 2026-1-1 18:29
本帖最后由 lx136648 于 2026-1-1 18:31 编辑

能帮我看一下怎么回事吗


[Shell] 纯文本查看 复制代码
检测到 GUI 框架: PyQt5
Run: D:/anaconda3/envs/pyqt5/python.exe -m nuitka --onefile --jobs=16 --lto=no --nofollow-import-to=pytest --nofollow-import-to=unittest --nofollow-import-to=_pytest --nofollow-import-to=hypothesis --nofollow-import-to=pandas.tests --nofollow-import-to=numpy.tests --nofollow-import-to=matplotlib.tests --nofollow-import-to=sklearn.utils.tests --nofollow-import-to=statsmodels.tests --nofollow-import-to=scipy.tests --nofollow-import-to=notebook --nofollow-import-to=IPython --enable-plugin=pyqt5 --include-qt-plugins=sensible,styles,platforms --nofollow-import-to=tkinter --assume-yes-for-downloads --remove-output --output-dir=C:/Users/33572/Desktop/arm/控制/LoRa兼容\dist_output C:/Users/33572/Desktop/arm/控制/LoRa兼容/控制程序.py --msvc=latest --windows-console-mode=disable --windows-icon-from-ico=C:/Users/33572/Desktop/arm/控制/LoRa兼容\dist_output\icon.ico --disable-plugin=upx
Nuitka-Options: Used command line options:
Nuitka-Options:   --onefile --jobs=16 --lto=no --nofollow-import-to=pytest --nofollow-import-to=unittest --nofollow-import-to=_pytest --nofollow-import-to=hypothesis --nofollow-import-to=pandas.tests --nofollow-import-to=numpy.tests --nofollow-import-to=matplotlib.tests --nofollow-import-to=sklearn.utils.tests --nofollow-import-to=statsmodels.tests --nofollow-import-to=scipy.tests --nofollow-import-to=notebook --nofollow-import-to=IPython --enable-plugin=pyqt5 --include-qt-plugins=sensible,styles,platforms --nofollow-import-to=tkinter --assume-yes-for-downloads --remove-output --output-dir=C:/Users/33572/Desktop/arm/控制/LoRa兼容\dist_output ~\Desktop\arm\控制\LoRa兼容\控制程序.py --msvc=latest --windows-console-mode=disable --windows-icon-from-ico=C:/Users/33572/Desktop/arm/控制/LoRa兼容\dist_output\icon.ico --disable-plugin=upx
Nuitka-Plugins:WARNING: pyqt5: For the obsolete PyQt5 the Nuitka support is incomplete. Threading, callbacks to compiled functions, etc. may not be working.
Nuitka-Plugins:WARNING:     Complex topic! More information can be found at https://nuitka.net/info/pyqt5.html
Nuitka: Starting Python compilation with:
Nuitka:   Version '2.7.13' on Python 3.10 (flavor 'Anaconda Python') commercial grade 'not installed'.
Traceback (most recent call last):
  File "D:\anaconda3\envs\pyqt5\lib\site-packages\nuitka\plugins\Plugins.py", line 71, in withPluginProblemReporting
    yield
  File "D:\anaconda3\envs\pyqt5\lib\site-packages\nuitka\plugins\Plugins.py", line 1150, in onCompilationStartChecks
    plugin.onCompilationStartChecks()
  File "D:\anaconda3\envs\pyqt5\lib\site-packages\nuitka\plugins\standard\PySidePyQtPlugin.py", line 86, in onCompilationStartChecks
    sensible_qt_plugins = self._getSensiblePlugins()
  File "D:\anaconda3\envs\pyqt5\lib\site-packages\nuitka\plugins\standard\PySidePyQtPlugin.py", line 218, in _getSensiblePlugins
    tuple(
  File "D:\anaconda3\envs\pyqt5\lib\site-packages\nuitka\plugins\standard\PySidePyQtPlugin.py", line 238, in <genexpr>
    if self.hasPluginFamily(family)
  File "D:\anaconda3\envs\pyqt5\lib\site-packages\nuitka\plugins\standard\PySidePyQtPlugin.py", line 461, in hasPluginFamily
    for plugin_dir in self.getQtPluginDirs()
  File "D:\anaconda3\envs\pyqt5\lib\site-packages\nuitka\plugins\standard\PySidePyQtPlugin.py", line 424, in getQtPluginDirs
    qt_info = self._getQtInformation()
  File "D:\anaconda3\envs\pyqt5\lib\site-packages\nuitka\plugins\standard\PySidePyQtPlugin.py", line 1341, in _getQtInformation
    if conda_prefix is not None:
UnboundLocalError: local variable 'conda_prefix' referenced before assignment
FATAL: pyqt5: Plugin issue while working on 'plugin startup checks'. Please report the bug with the above traceback included.
Nuitka-Reports: Compilation crash report written to file 'nuitka-crash-report.xml'.
3#
msn882 发表于 2026-1-1 18:39
谢谢分享
4#
博爵 发表于 2026-1-1 18:43
打包工具很多呀,感谢分享
6#
zt185 发表于 2026-1-1 18:54
很不错的小工具,下载了!
7#
蒲公英的约定 发表于 2026-1-1 19:06
感谢,看一下这个是什么
8#
 楼主| Ar11223 发表于 2026-1-1 19:25 |楼主
lx136648 发表于 2026-1-1 18:29
能帮我看一下怎么回事吗

这个应该是nuitka打包pyqt框架的问题,为了加快打包的速度,我对打包的nuitka方式中大型大型库进行了分割。等我再试一试。
10#
lanyanlanya 发表于 2026-1-1 19:55
很不错的小工具,下载了
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - 52pojie.cn ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2026-1-2 14:49

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表