Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
944 views
in Technique[技术] by (71.8m points)

pyinstaller - Packing python scripts into .exe file while keeping imported modules

I have a python script I want to pack into .exe file for the ease of use. The python script makes extensive use of Tkinter module for nice GUI. I've packed it first into .exe using pyinstaller and the guide outlied here - https://datatofish.com/executable-pyinstaller/

I have two problems. First is that my script makes use of FlowCal module, which doesn't come with Python's pyinstaller (I've made script using Spyder, and I'm using Python 3.8. to compile using pyinstaller) - so I installed FlowCal with pip install FlowCal so Python gets it too (I think that's how it works? Not too sure). But then FlowCal is dependent on various sklearn modules, and it would be a headache to install modules, compile to exe, then check if it works over and over. Is there a way that ALL modules script uses (and ALL modules that imported modules use) are compiled into the script?

Second problem is that alongside GUI I get another window. Picture included. How do I remove that window?

Picture of that another window (right) with the GUI window (left)

question from:https://stackoverflow.com/questions/65918647/packing-python-scripts-into-exe-file-while-keeping-imported-modules

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Another thing you can do without any hassle is using auto-py-to-exe. This will generate .exe from .py with writing command, just clicking some buttons in a GUI. For this, you have to give the command: pip install auto-py-to-exe in command prompt or PowerShell, whatever you like most. After successfully installing auto-py-to-exe, give the command auto-py-to-exe in your command prompt. Then give the necessary informations, and get your generated executable file!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...