How To Include Only Needed Modules In Pyinstaller?
Solution 1:
For this you need to create a separate environment, because currently you are reading all the modules you have installed on your computer. To create environment run commands
1 - if you don't have one, create a requirements.txt
file that holds all packages that you are using, you could create one with:
pip freeze > requirements.txt
2 - create env folder:
python -m venv projectName
3 - activate the environment:
source projectName/bin/activate
4 - install them:
pip install -r requirements.txt
alternatively if you know you are using only wxpython you could just pip install wxpython
5 - then finally you can run pyinstaller
on your main script with the --path
arg as explained in this answer:
pyinstaller --paths projectName/lib/python3.7/site-packages script.py
Solution 2:
I don't think it can figure that out for you. If there are any specific modules taking a while to load, use the --exclude-module
flag to list all the modules you want to exclude.
edit: this answer may have some more helpful info
Post a Comment for "How To Include Only Needed Modules In Pyinstaller?"