GUI 打包

GUI 打包

  1. 安装pyinstaller

    PyInstaller 将 Python 应用程序及其所有依赖项捆绑到一个包中。用户无需安装 Python 解释器或任何模块即可运行打包的应用程序。

    Project description
    PyInstaller bundles a Python application and all its dependencies into a single package. 
    The user can run the packaged app without installing a Python interpreter or any modules.
    

    安装:

    pip install pyinstaller (如果安装失败,用管理员权限安装)

  2. 打包程序

    pyinstaller /path/to/yourscript.py

  3. 扩展:

    (1)将ico图片、和代码同一文件夹
    (2)Win+R,cmd进入管理员界面 cd切换到代码目录
    (3)输入命令pyinstaller -F -w -i C:\demo\image.ico demo.py
    	-F 表示打包(F 大写)
    	-w 取消控制台显示(w 小写)
    	-i 有错误也继续执行(i 小写)
    		ico图片路径(绝对路径)
    		最后是代码名称
    (4)如果程序里面有图片,需要将图片复制到exe文件同一级文件夹,否则程序无法正常运行
        注意:
        	文件路径千万不要有中文,否则会出现一些编码方面的错误。
    

    参考:https://blog.csdn.net/weifuliu/article/details/82826643

posted @ 2021-06-18 12:51  reverie81  阅读(153)  评论(0)    收藏  举报