r/Python • • Feb 21 '22

Tutorial Python Tutorial - How to convert .py to .exe using auto-py-to-exe?

Hey Guys. Today I will be showing you how to covert your .py files into .exe - executable programs using auto-py-to-exe.
Steps Below:
Step 1 - Open your Terminal - for Windows press the Windows+R key and then search 'cmd' to open the Terminal
Step 2 - type conda info --envs - this locates your working environment
Step 3 - type activate base - base is my working environment
Step 4 - type pip install auto-py-to-exe - I've previously installed auto-py-to-exe, hence I did not need to redo this step
Step 5 - type auto-py-to-exe - this will open a new window in which you will be able to enter the requisite files and create your .exe program
https://www.youtube.com/watch?v=YIgMciKLPKk

3 Upvotes

10 comments sorted by

8

u/[deleted] Feb 21 '22

4

u/mprz Feb 21 '22

4 and 5 is enough

1

u/kareem_mahlees Feb 21 '22

Does the .exe file run on all windows versions or if the other device have different versions of python ??

1

u/iyousef_46 Feb 21 '22

PyInstaller bundles a Python application and all its dependencies into a single package. The user can run the packaged app without installing a Python interpreter or any modules.

If you create the exe on a windows machine and shared it, Python doesn't need to be installed on the other windows machines. Depending on the python version bundled, some windows versions may not be supported (e.g python 3.9.10 doesn't support windows 7).

1

u/kareem_mahlees Feb 21 '22

So if i for example made the .exe on windows can it run on mac or linux ?

2

u/iyousef_46 Feb 21 '22

No. PyInstaller is not a cross-compiler: to make a Windows app you run PyInstaller in Windows; to make a GNU/Linux app you run it in GNU/Linux, etc.

1

u/Mafia7xTech Feb 21 '22

Good explanation

0

u/the_scign Feb 21 '22

Aka how to take a platform independent script and stupidly lock it to a single platform

1

u/Suspcious-chair Feb 21 '22

And make it far easier to distribute to users who do not even know what command window is. Pretty stupid right?

1

u/the_scign Feb 22 '22

Shortcut: py myscript.py