How to create an executable with Python? .exe
In this article we are going to learn how to create an executable with Python, in a simple way using a very interesting lib!
What’s up programmer, how are you? Let’s learn more about Python!
The library we’re going to use is called pyinstaller, and the good news is that it’s very easy to use.
First let’s install it:
python3 -m pip install pyinstaller –upgrade
You now have access to pyinstaller, test using this command:
The lib version should be displayed, if any error is displayed, try to redo the installation as something went wrong
Now the next step is to run the lib on your file that contains the executable logic
For example, if you have a file called program.py, you would do the following:
Presto! The library will do the work necessary to generate your .exe
Afterwards a folder called dist will be created, inside it a folder with the name of your .py file will be created
And in this folder, in our case it is the program folder, it will have the executable file!
To consult the possibilities and documentation of pyinstaller, see its documentation
In this article we learned how to create an executable with Python
We use the pyinstaller library, which was installed via pip
In it we just run the pyinstaller command on the destination file, and the executable was created
Do you want to learn more about Python? Click here!