Convert .Py to .exe
Jump to navigation
Jump to search
Converting a Python script (.py) to an executable (.exe) file for Windows can be achieved using tools like PyInstaller
Using PyInstaller (Command Line):
Install PyInstaller: Open your command prompt or terminal and execute:
pip install pyinstaller
- Navigate to your script's directory: Use the cd command to change the directory to where your Python script is located. For example
cd C:\Users\YourUser\Documents\PythonProjects
- Run PyInstaller: Execute the following command, replacing your_script_name.py with the actual name of your Python file:
pyinstaller your_script_name.py
- To create a single executable file (instead of a directory with dependencies), add the --onefile flag:
pyinstaller --onefile your_script_name.py
- pyinstaller --onefile your_script_name.py