Рет қаралды 118
In this video, I’ll show you how to easily convert your Python scripts into executable files (.exe) using PyInstaller. Whether you want to share your Python project without requiring others to install Python or make your scripts easier to run, this step-by-step tutorial has you covered. Plus, I’ll include tips on customizing your executable with an icon, as well as troubleshooting common issues with PyInstaller and Pip.
What you'll learn:
Installing PyInstaller
Open Command Prompt (CMD) and make sure Pip is installed. Type:
pip --version
If you get an error, Python may not have been installed with Pip. Make sure you select the option to install Pip during Python installation.
Install PyInstaller by typing:
pip install pyinstaller
Check if it was installed successfully by typing:
pyinstaller --version
Converting Python Script to EXE
Navigate to the folder where your Python script is located.
Use the cd command to change directories:
cd path/to/your/python/script
Run PyInstaller to convert your script to an .exe file:
pyinstaller your_script.py --onefile
Optional: Add an icon to your executable:
pyinstaller your_script.py --onefile --icon=your_icon.ico
Customizing your .EXE output
Learn how to include additional resources, such as images or text files, in the final .exe file.
Troubleshooting Tips
If Pip isn't recognized, check if Python was installed with "Add Python to PATH" checked.
Ensure you're running these commands in Command Prompt (CMD), not PowerShell or another terminal.
Check Python and Pip versions to make sure they are up to date:
python --version
pip --version
If PyInstaller throws an error about missing modules, install the required modules via Pip.
By the end of this video, you’ll know how to turn your Python scripts into standalone executable files and avoid common issues along the way!