赞
踩
在这里可以找到Python支持的所有wxPython版本:https://pypi.tuna.tsinghua.edu.cn/simple/wxpython/
由于Python从3.6版本开始支持f字符串、从3.9版本开始不支持Windows7操作系统,所以我仅筛选3.6-3.8之间的版本。
应用正则表达式:
.*cp3[6-8].*win32.whl
得到以下版本:
wxPython-4.0.0-cp36-cp36m-win32.whl
wxPython-4.0.0a1-cp36-cp36m-win32.whl
wxPython-4.0.0a2-cp36-cp36m-win32.whl
wxPython-4.0.0a3-cp36-cp36m-win32.whl
wxPython-4.0.0b1-cp36-cp36m-win32.whl
wxPython-4.0.0b2-cp36-cp36m-win32.whl
wxPython-4.0.1-cp36-cp36m-win32.whl
wxPython-4.0.2-cp36-cp36m-win32.whl
wxPython-4.0.2-cp37-cp37m-win32.whl
wxPython-4.0.3-cp36-cp36m-win32.whl
wxPython-4.0.3-cp37-cp37m-win32.whl
wxPython-4.0.4-cp36-cp36m-win32.whl
wxPython-4.0.4-cp37-cp37m-win32.whl
wxPython-4.0.5-cp36-cp36m-win32.whl
wxPython-4.0.5-cp37-cp37m-win32.whl
wxPython-4.0.6-cp36-cp36m-win32.whl
wxPython-4.0.6-cp37-cp37m-win32.whl
wxPython-4.0.7-cp36-cp36m-win32.whl
wxPython-4.0.7-cp37-cp37m-win32.whl
wxPython-4.0.7-cp38-cp38-win32.whl
wxPython-4.0.7.post1-cp36-cp36m-win32.whl
wxPython-4.0.7.post1-cp37-cp37m-win32.whl
wxPython-4.0.7.post1-cp38-cp38-win32.whl
wxPython-4.0.7.post2-cp36-cp36m-win32.whl
wxPython-4.0.7.post2-cp37-cp37m-win32.whl
wxPython-4.0.7.post2-cp38-cp38-win32.whl
wxPython-4.1.0-cp36-cp36m-win32.whl
wxPython-4.1.0-cp37-cp37m-win32.whl
wxPython-4.1.0-cp38-cp38-win32.whl
wxPython-4.1.1-cp36-cp36m-win32.whl
wxPython-4.1.1-cp37-cp37m-win32.whl
wxPython-4.1.1-cp38-cp38-win32.whl
wxPython-4.2.1-cp38-cp38-win32.whl
取一些大版本号,和新增Python支持的版本,还剩这些:
wxPython-4.0.0-cp36-cp36m-win32.whl
wxPython-4.0.2-cp36-cp36m-win32.whl
wxPython-4.0.2-cp37-cp37m-win32.whl
wxPython-4.0.7-cp36-cp36m-win32.whl
wxPython-4.0.7-cp37-cp37m-win32.whl
wxPython-4.0.7-cp38-cp38-win32.whl
wxPython-4.1.0-cp36-cp36m-win32.whl
wxPython-4.1.0-cp37-cp37m-win32.whl
wxPython-4.1.0-cp38-cp38-win32.whl
wxPython-4.1.1-cp36-cp36m-win32.whl
wxPython-4.1.1-cp37-cp37m-win32.whl
wxPython-4.1.1-cp38-cp38-win32.whl
wxPython-4.2.1-cp38-cp38-win32.whl
安装好Python和pyinstaller,这个就不说了。
由于打包32位版的Python程序普遍比64位版体积小很多,所以我就只下载32位版本的Python了。
首先写一个wxPython程序,嗯。。非常简单:
# demo.py
import wx
import sys
app = wx.App()
title = f'window-py{sys.winver}-wx{wx.__version__}'
frame = wx.Frame(None, -1, title)
frame.Center()
frame.Show()
app.MainLoop()
然后运行批处理文件开始打包:
@echo off set install=-m pip install set dist=-m PyInstaller -ywsF --noupx demo.py --name py -3.6-32 %install% wxpython==4.0.0 py -3.6-32 %dist% demo-py36-wx400.exe py -3.6-32 %install% wxpython==4.0.2 py -3.6-32 %dist% demo-py36-wx402.exe py -3.7-32 %install% wxpython==4.0.2 py -3.7-32 %dist% demo-py37-wx402.exe py -3.6-32 %install% wxpython==4.0.7 py -3.6-32 %dist% demo-py36-wx407.exe py -3.7-32 %install% wxpython==4.0.7 py -3.7-32 %dist% demo-py37-wx407.exe py -3.8-32 %install% wxpython==4.0.7 py -3.8-32 %dist% demo-py38-wx407.exe py -3.6-32 %install% wxpython==4.1.0 py -3.6-32 %dist% demo-py36-wx410.exe py -3.7-32 %install% wxpython==4.1.0 py -3.7-32 %dist% demo-py37-wx410.exe py -3.8-32 %install% wxpython==4.1.0 py -3.8-32 %dist% demo-py38-wx410.exe py -3.6-32 %install% wxpython==4.1.1 py -3.6-32 %dist% demo-py36-wx411.exe py -3.7-32 %install% wxpython==4.1.1 py -3.7-32 %dist% demo-py37-wx411.exe py -3.8-32 %install% wxpython==4.1.1 py -3.8-32 %dist% demo-py38-wx411.exe py -3.8-32 %install% wxpython==4.2.1 py -3.8-32 %dist% demo-py38-wx421.exe
运行结果:
汇总表格:
Python-32bit 版测试结果:
wx\py | 3.6 | 3.7 | 3.8 |
---|---|---|---|
4.0.0 | 8.69 MB | - | - |
4.0.2 | 8.70 MB | 8.13 MB | - |
4.0.7 | 8.73 MB | 8.16 MB | 8.17 MB |
4.1.0 | 10.03 MB | 9.46 MB | 9.48 MB |
4.1.1 | 10.10 MB | 9.54 MB | 9.55 MB |
4.2.1 | - | - | 9.85 MB |
Python-64bit 版测试结果:
wx\py | 3.6 | 3.7 | 3.8 |
---|---|---|---|
4.0.0 | 11.00 MB | - | - |
4.0.2 | 11.01 MB | 10.56 MB | - |
4.0.7 | 11.04 MB | 10.59 MB | 10.56 MB |
4.1.0 | 12.75 MB | 12.30 MB | 12.27 MB |
4.1.1 | 12.84 MB | 12.40 MB | 12.37 MB |
4.2.0 | - | 12.37 MB | 12.34 MB |
4.2.1 | - | - | 12.36 MB |
最终结论:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。