Scenario : We want to convert a python application into standalone windows application.
Required Package : https://pyinstaller.readthedocs.io/en/stable/
What is Pyinstaller :
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. PyInstaller supports Python 2.7 and Python 3.4+, and correctly bundles the major Python packages such as numpy, PyQt, Django, wxPython, and others.
PyInstaller is tested against Windows, Mac OS X, and GNU/Linux. However, it 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. PyInstaller has been used successfully with AIX, Solaris, and FreeBSD, but is not tested against them.
How to Install :
In Anaconda : Search for pytinstaller and install it
In command Line : use pip install pyinstaller
How To create the first EXE File:
Create a sample python application with below code and save as test.py
def my_usdsalary(x): return 3.67 * x name = input("Enter Employee Name : ") salary = input("Enter salary : ") company = input ("Enter Company name : ") print("Printing Employee Details ") print ("Name","AED Salary", "USD Salary", "Company") print (name, salary, my_usdsalary(int(salary)), company)
now open command prompt and change directory to the location you saved the .py file
Now you will see 2 folders created by pyinstaller
Now open the file test.exe from dist folder
See the output as follows
Note that this is not cross platform.
If you convert in Windows you can only use in Windows
If you convert in Unix you can only use in Unix.