I made a simple script, turned it into an exe but the final output using auto py to exe with one directory mode was 170 mb, with one file mode it was 64 mb. Thats insane, anyway I can only copy the parts of libraries that my script needs?
EDIT: My script is simple, this is it The libraries are tkinter, keyboard, pyautogui, pywinauto and time.
CodePudding user response:
You could create a virtual environment where you can install your required modules and then create the exe file in that environment itself. The python base library would be there anyway. Check out : How to include only needed modules in pyinstaller?
CodePudding user response:
Use pyinstaller
to convert python files to exe.
Installation: pip install pyinstaller
Convert (in Terminal): pyinstaller --onefile "path_to_file.py"
This would create a "dist" folder in the directory you ran the code in and it would contain the ".exe" file of the python file, this only installs the modules used in the program.
But unfortunately, Size of exe Files are usually big due to the modules used, and cannot be helped (in my opinion)