Pyinstaller Reduce Packed Program Size
Pyinstaller Reduce Packed Program Size
When I was packing Xevent Reader
with
pyinstaller
, I created a new conda virtual environment and
installed the necessary python packages. However, the size of the packed
program is very large, 200MB+, and runs very slow. This problem is
solved by using pipenv
virtual environment.
Install pipenv
Working environment: Anaconda Prompt
1 |
|
Create a new folder for the virtual environment.
Setup virtual environment
Get into the folder created.
1 |
|
Setup the virtual environment.
1 |
|
Activate the virtual environment.
1 |
|
Packing
Install necessary packages for your program, including
pyinstaller
1 |
|
You can try to run your python script first to test if it runs correctly under this environment.
1 |
|
Download UPX to help further
reduce file size and avoid triggering security warnings when running the
program on other machines. Copy upx.exe
to the location of
your script.
Packing. Make sure INFO: UPX is available
is prompted in
the cmd window.
1 |
|