I am attempting to use cx_Freeze as an alternative to my usual application for converting .py to .exe (auto-py-to-exe). When I run it in cmd I get:
C:\\WINDO
Step 1: Add Python to Windows Path
Step 2: Open the Windows Command Prompt as administrator
Step 3: Install the Pyinstaller Package
In the Windows Command Prompt, type the following command to install the pyinstaller package (and then press Enter):
pip install pyinstaller
Step 4: Save your Python Script
I then saved the Python script in the following folder:
C:\Users\Ron\Desktop\MyPython
Where I named the Python script as ‘hello’
Step 5: Create the Executable using Pyinstaller
Now you’ll be able to create the executable from the Python script using pyinstaller.
Simply go to the Command Prompt, and then type:
cd followed by the location where your Python script is stored
In my case, I typed the following in the command prompt:
cd C:\Users\Ron\Desktop\MyPython
Next, use the following template to create the executable:
pyinstaller --onefile pythonScriptName.py
Since in our example, the pythonScriptName is ‘hello‘, then the command to create the executable is:
pyinstaller --onefile hello.py
Once you’re done, press Enter for the last time.
Step 6: Run the Executable
Your executable should now get created at the location that you specified.
In my case, I went back to the location where I originally stored the ‘hello’ script
(C:\Users\Ron\Desktop\MyPython).
Few additional files got created at that location. To find the executable file, open the dist folder:
Now I hope that solves the question..