Reducing size of pyinstaller exe

前端 未结 4 1297
天涯浪人
天涯浪人 2020-11-29 23:21

I have a simple pandas pyinstaller exe which is over 40MB.

My exe example:

import collections
import csv
import selenium
import pandas

print(\'hi\')         


        
4条回答
  •  无人及你
    2020-11-29 23:35

    I use the Anaconda environment and so the virtualenv solution isn't an option. my way was to exclude unnecessary modules in my spec file, ex.:

    in Analysis(...)

    excludes=['pandas', 'numpy'],
    

    (this are modules whose raise the size of the files extraordinarily)

    For every build i'm using this adjusted spec file to create the exe.

    pyinstaller "mySpec.spec" --distpath=""
    

提交回复
热议问题