using pyinstaller to package the python application
- 318 Views
- No Comments on Pyinstaller
Recently i had to convert a python application i wrote to an executable that works on computers that don’t have Python installed.
I came across the amazing tool called Pyintsaller ( follow this url: pyinstaller.org) that converts the Python applications into stand-alone executables, under Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and AIX.
Initially i tried other free tools available over internet but this one was works very cool even for a non-python user like me.
The thing i like compared to other similar tools is that PyInstaller works with Python 2.7 and 3.5—3.7 and it builds the smaller executables due to its transparent compression, and it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility.
Steps to use pyinstaller
if you are using Linux distribution( in my case, centos 7), install the pyinstaller using pip.
sudo pip36 install pyinstaller
check if the package is properly installed by checking the version.
Go to the directory where your program and icon resides and run the below command. In below command, i gave the long version as few might want to run the PyInstaller with python3. also make sure your PyInstaller is installed for python 3.x by command : pip3 freeze which returns the PyInstaller version. in my case: its 3.6.
After successful completion of above PyInstaller command , you can find the executable created under the directory dist as shown below.
Now you can run the executable in computers that doesnt have python installed.
Go to GUI mode and double click the BarFileValidator,you can see the tool being opened without any python support.
more details on usage of PyInstaller can be read online : https://pyinstaller.readthedocs.io/en/stable/usage.html
Disclaimer : Pyinstaller and python etc are trademarks of respective owners and i do not own any copyrights.Image source from Pyinstall.org