Purpose of the Article: Execute python code without having Python installed in the system, which will be used for NON-TECHNICAL Persons.
Intended Audience: Python Developers
Tools and Technology: Python
Keywords: PyInstaller, Single Executable file, non-Technical
HOW TO CREATE A PYTHON STAND-ALONE APPLICATION?
- As most of us know, Python is the most flexible Programming language and is simple to understand.
- We might come across some situations where we may need to set up a complete installation of python into other systems to execute code and achieve
- It will be a typical process to complete the setup of Python installation and to execute python code multiple times by using any one of the Python terminals like Visual Studio code, Pycharm, Jupyter Notebook, etc… for non-technical
- We have to follow the below steps to execute the python code:
- Download the Python-specific version based on the requirement.
- Install required packages.
- Install the required PIP version.
- Install a Copy of Python code.
- The Above steps look fine for the Developer, but for a Non-Technical person, it will be really difficult to follow all the processes.
- Here is the Solution……. to achieve it in a single step without performing all the steps i.e.,
- Let us go into detail about PYINSTALLER…!
WHAT IS Pyinstaller?
- Pyinstaller is one of the packages in Python, where it groups all dependencies and gives a single executable file(.exe).
- It works by simply using the .exe file which is generated from Pyinstaller and can be used to execute a python code without having python installed on a machine.
STEPS TO IMPLEMENT TO GET A SINGLE EXECUTABLE FILE IN WINDOWS
STEP 1: Install Pyinstaller using the below syntax in any one of the python terminals like Command prompt, Visual Studio code, PyCharm.
STEP 2: After installing pyinstaller, use the below syntax to group all dependencies in a single file.
Example: We have one simple python file which has a text message called “Hello World” i.e. test.py
- After executing the above command, we will get the output as shown below:
- We will get multiple folders created after the above command gets executed.
- We can see an executable file inside the dist
- If we just double-click on it, we will get desired output.
- We can send the above executable file to non-technical persons where they can get desired output without having PYTHON installed in their system/machine