Last updated on 23/02/2023
- Open a command window using “cmd” or open an Anaconda Prompt if you are using Anaconda
- Type: pip install pyinstaller
- Save your script “xxx.py” and all necessary files in the destination folder
- Move to the destination folder (using the “cd” command from the same terminal)
- Type: pyinstaller xxx.py
A folder named “dist” will be generated, containing the executable “.exe” and the necessary libraries. You can now distribute this folder and delete the other folders and files created by pyinstaller.
If you prefer a single executable file instead of a folder, at step 5. above use the option “– – onefile“: pyinstaller – – onefile xxx.py (note: don’t use a space between the dashes or between the dashes and ‘onefile’).
pyinstaller comes with several options, such as using a custom icon. If you want to know more, have a look at the official manual.
Be First to Comment