top of page

How To Create A . Py Python Script As An .exe Executable File

  • Writer: Brian Clark
    Brian Clark
  • Oct 7, 2021
  • 1 min read

Let us jump right into the steps to take your python script and make it a .exe program.


Step 1 - Add Python To Windows PATH (Manually)

Click the following link to add python to windows PATH manually or when you set up python for the first time: How to add python to Windows Path.


Step 2 -Run Command Prompt As Administrator

A. Right-click on the command prompt and run as administrator.

B. Cd to the directory of your python script, for example:


Cd C:\Users\Thinkpad.THINK\Desktop\Python_Vs


Step 3 - copy and paste the following command to create a virtual environment :

py -m venv env


Step 4 - copy and paste: env\Scripts\activate


Step 5 - copy and paste: pip install pyinstaller


Step 6 - copy and paste: pyinstaller --onefile Your_File_Name.py


Step 7 - go to the Dist folder and run the exe file.



When I first tried to do this, I had trouble because python was not in the windows PATH, so make sure that is there first before attempting this.



Create A Logo For Your New File - RH


I added a logo to my program, but I still want to make a GUI and more functionality to the program I am working on finishing.











 
 
 

Comments


bottom of page