covert py to exe

Convert .py to .exe ( Python to Executable).

Hey, what’s up python people in this article I’m going to guide you on how you can convert a python program file (.py) into windows executable file (.exe). Converting python files into the executable is not a big task. All you need is a python library and write a line of code and that’s it. Your python file is converted into an executable in just a sec.

Why You need to convert .py into executable file (.exe)?

There are many reasons to convert a python .py file into a .exe executable file. Like you have made a python program and wanted to share it with your friends and colleagues but didn’t have installed the python on their machine or pc whatever they have. Or You have used used different library which they didn’t install on their pc and to avoid the module not found error etc. or you can say that u didn’t wanted to share or see your code so that you have converted it into an executable file that they can only run it and not to see the source code of your python program.

there are plenty of reasons to convert your python .py file into .exe executable file.

So To Convert Your File Into Exe You have to install a module called pyinstaller . You can install using your window command prompt using command:

pip install pyinstaller

After the completion of installation pyinstaller. Just go to your python program folder or directory
and Press Shit + Right Click On Mouse. A Window Will Appear Like This..

See also  URL Shortener using Python

After that click on open command window here..It will open cmd prompt on your current directory
and type the command..

pyinstaller /path/to/yourscript.py     #(replace notepad.py with your py programm)
covert py to exe

Im converting My notepad.py to .exe like that type “pyinstaller and your python program” and hit enter.It will take couple of minute to covert depending on your program size. After the completion of process of converting.You will see that there will be new folders are created.

To see your Exe file just open the “dist’ folder.

covert py to exe

And Your will be seen  yourProgram.exe file..

covert py to exe

Just Double click on the file to run the program and You guys can also share your program to another computer and it will not required the installation of python on another pc to run the program.

Customizing Your Builds :

pyinstaller comes with alot of customization and modification like you can change the name of file or convert your python program into exe in a single file.

–name

change the of executable file.

pyinstaller /path/to/yourscript.py --name inprogrammer

–onefile

This one is kind of handy it will be helpful if you wanted to convert python program to exe in a single file. You dont want other stuff or folders.

pyinstaller /path/to/yourscript.py --onefile 

Besides these two function there are also many features of pyinstaller. To explore more about pyinstaller read the document from Here.

Leave a Comment

Your email address will not be published.

Ads Blocker Image Powered by Code Help Pro
Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Refresh