推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
woshichuanqilz
V2EX  ›  Python

如何让 pyinstaller 生成的文件小一点

  •  
  •   woshichuanqilz · Sep 9, 2018 · 3869 views
    This topic created in 2945 days ago, the information mentioned may be changed or developed.

    用的 anaconda 建立了一个 venv, 里面只装了必要的 package, 但是用 pyinstaller 生成的文件 500 多 m,这个有点太大了, 这个能有什么办法让文件小一点吗?

    代码里面引用的包就是这些, 文件要这么大吗?

    import subprocess
    import datetime
    import random
    import json
    import os
    import threading
    import cv2
    import pyautogui
    import numpy as np
    import win32gui
    import time
    
    5 replies  •  2018-09-09 11:40:33 +08:00
    PythonAnswer
        1
    PythonAnswer  
       Sep 9, 2018
    大包
    cv2
    numpy
    sw0rd3n
        2
    sw0rd3n  
       Sep 9, 2018 via iPhone   ❤️ 1
    开 upx 压缩
    ksc010
        3
    ksc010  
       Sep 9, 2018
    用 from import 试下 之引用需要的包
    标准库 应该挺小的 感觉主要是
    import cv2
    import pyautogui
    import numpy as np
    import win32gui
    这几个大
    woshichuanqilz
        4
    woshichuanqilz  
    OP
       Sep 9, 2018
    我发现一个问题了, 就是不用 anaconda 做 venv 的话体积小很多楼上的方法我再试试
    jmzz
        5
    jmzz  
       Sep 9, 2018
    用的 miniconda,体积大应该还是 GUI 相关的库,pyqt 压缩后 60M
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2517 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 13:09 · PVG 21:09 · LAX 06:09 · JFK 09:09
    ♥ Do have faith in what you're doing.