How to Convert a Python file to .EXE with Images

Опубликовано: 13 Март 2026
на канале: Kenny Yip Coding
372
23

Convert python file to .exe . By converting your python file to an executable file, you can share your project with other people, without having them install python and dependent packages.

Install the pyinstaller package for converting .py to .exe:
pip install pyinstaller

Run the converter on your main py file:
pyinstaller flappybird.py --onefile --noconsole --add-data "toppipe.png;." --add-data "bottompipe.png;." --add-data "flappybirdbg.png;." --add-data "flappybird.png;." --icon=flappybirdicon.ico

You can add additional flags:
--onefile to package your project into a single .exe file
--noconsole to avoid opening the terminal/console/command prompt
--add-data to add image files
--icon to change the icon of the .exe file

Other links:
How to install Pip:    • How to Install PIP in Python  

How to install Python for VS Code:    • How to set up Python on Visual Studio Code  

Code flappy bird in python with pygame:    • Code Flappy Bird in Python with Pygame  

Flappy bird Pygame source code: https://github.com/ImKennyYip/flappy-...

Create an Icon (.ico) file: https://www.freeconvert.com/ico-conve...

⭐ If you enjoyed the tutorial and would like to support the channel, you can do so here 💖: https://buymeacoffee.com/kennyyipcoding