9/6/24, 4:14 PM How to create executable of your Python application for Linux / Windows / Mac | by Ganesh Chandrasekaran | Analytics
lytics Vidh…
This member-only story is on us. Upgrade to access all of Medium.
Member-only story
How to create executable of your
Python application for Linux /
Windows / Mac
Ganesh Chandrasekaran · Follow
Published in Analytics Vidhya · 2 min read · Oct 9, 2020
78 1
Python is well known as Interpreted language. But when deploying Python
application there is always a dependency of using right version of libraries.
Tools like Ansible / Docker solve this problem in one way. Creating an
installer solves the the problem in another way.
https://medium.com/analytics-vidhya/how-to-create-executable-of-your-python-application-from-linux-windows-mac-bcbcdd4603d4 1/8
9/6/24, 4:14 PM How to create executable of your Python application for Linux / Windows / Mac | by Ganesh Chandrasekaran | Analytics Vidh…
Photo : Hitesh Choudhary
PyInstaller library helps you to create an executable (binary) version of your
Python script.
Step 1 : Make sure python3 development libraries are available (Linux users)
sudo apt-get install python3-dev
Step 2 : Install PyInstaller library
(Linux / Mac / Windows users)
pip3 install pyinstaller
(Linux users use sudo if needed)
https://medium.com/analytics-vidhya/how-to-create-executable-of-your-python-application-from-linux-windows-mac-bcbcdd4603d4 2/8
9/6/24, 4:14 PM How to create executable of your Python application for Linux / Windows / Mac | by Ganesh Chandrasekaran | Analytics Vidh…
Step 2a : Existing pyinstaller user ? then upgrade it
(Linux / Mac / Windows users)
pip3 --upgrade pyinstaller
(Linux users use sudo if needed)
Step 2b : Verify the installation with
(Linux / Mac / Windows users)
pyinstaller --version
Step 3 : Navigate to your folder which has Python file
Open in app
(Linux / Mac / Windows
Search users) Write
pyinstaller yourfile.py --onefile
The installer will collect -> build -> generate the executable.
After the success message, navigate to following folder
(Linux / Mac users)
https://medium.com/analytics-vidhya/how-to-create-executable-of-your-python-application-from-linux-windows-mac-bcbcdd4603d4 3/8
9/6/24, 4:14 PM How to create executable of your Python application for Linux / Windows / Mac | by Ganesh Chandrasekaran | Analytics Vidh…
cd ./yourfolder/dist/
(Windows users)
cd .\yourfolder\dist\
Step 4 : Verify the executable file
Windows users double click the
c:\yourfolder\yourfile.exe
Linux/Mac users execute it by
$ ./yourfile
Note 1 : This executable can be invoked via Cronjobs / Task Scheduler or DAG
tools like Apache Airflow.
Note 2 : This article has the basic method, but pyinstaller has lot of features
which can be reviewed here.
PyInstaller Manual - PyInstaller 4.0 documentation
https://medium.com/analytics-vidhya/how-to-create-executable-of-your-python-application-from-linux-windows-mac-bcbcdd4603d4 4/8
9/6/24, 4:14 PM How to create executable of your Python application for Linux / Windows / Mac | by Ganesh Chandrasekaran | Analytics Vidh…
PyInstaller is tested against Windows, Mac OS X, and GNU/Linux.
However, it is not a cross-compiler: to make a Windows…
pyinstaller.readthedocs.io
Python3 Pyinstaller Binary Linux Windows
Written by Ganesh Chandrasekaran Follow
1.3K Followers · Writer for Analytics Vidhya
Big Data Solution Architect | Adjunct Professor. Thoughts and opinions are my own
and don’t represent the companies I work for.
More from Ganesh Chandrasekaran and Analytics Vidhya
https://medium.com/analytics-vidhya/how-to-create-executable-of-your-python-application-from-linux-windows-mac-bcbcdd4603d4 5/8
9/6/24, 4:14 PM How to create executable of your Python application for Linux / Windows / Mac | by Ganesh Chandrasekaran | Analytics Vidh…
Ganesh Chandrasekaran in Python in Plain English Kia Eisinga in Analytics Vidhya
Databricks Notebooks: Create How to create a Python library
Python Class definitions across… Ever wanted to create a Python library, albeit
Let's quickly learn how to create class for your team at work or for some open…
methods (functions) across multiple cells in…
Aug 17 54 1 Jan 27, 2020 2.7K 28
Harikrishnan N B in Analytics Vidhya Ganesh Chandrasekaran in Python in Plain English
Confusion Matrix, Accuracy, Medallion Architecture in PySpark:
Precision, Recall, F1 Score From Basic Scripts to Advanced…
Binary Classification Metric In this article, I will introduce you to the
Medallion Architecture approach to…
Dec 10, 2019 1.1K 6 Feb 13 484 6
See all from Ganesh Chandrasekaran See all from Analytics Vidhya
Recommended from Medium
https://medium.com/analytics-vidhya/how-to-create-executable-of-your-python-application-from-linux-windows-mac-bcbcdd4603d4 6/8
9/6/24, 4:14 PM How to create executable of your Python application for Linux / Windows / Mac | by Ganesh Chandrasekaran | Analytics Vidh…
Corey Jones in T3CH Max Zhang in DevOps.dev
Notion Command: Streamline your How to install the anaconda python
Thoughts & Tasks with Python distribution on ubuntu
I have a lot of trouble writing in my journal introduction
everyday, I’m aware that incorporating this…
Aug 23 119 May 8 138 2
Lists
General Coding Knowledge MODERN MARKETING
20 stories · 1545 saves 180 stories · 827 saves
Staff Picks
727 stories · 1277 saves
Lee Vaughan in Python in Plain English Abhay Parashar in The Pythoneers
https://medium.com/analytics-vidhya/how-to-create-executable-of-your-python-application-from-linux-windows-mac-bcbcdd4603d4 7/8
9/6/24, 4:14 PM How to create executable of your Python application for Linux / Windows / Mac | by Ganesh Chandrasekaran | Analytics Vidh…
Introducing Conda Environments 25 Amazing Python Tricks That
Learn to love the Command Line! Will Instantly Improve Your Code
Get a sneak peek of top techniques used by
top Developers to Write Clean, Efficient…
Feb 14 475 4 Aug 30 693 7
Anna Cole in Python’s Gurus Konstantin Mogilevskii in Level Up Coding
Building a Python App Using 3 Tricks To Write Python’s If-
Terminal Statements Like a Pro in just 5…
A beginner’s guide on how to build a simple Comparison: if all(...) vs. if with Multiple and
Python application with a command line… Conditions
Feb 1 690 4 Aug 25 185 2
See more recommendations
https://medium.com/analytics-vidhya/how-to-create-executable-of-your-python-application-from-linux-windows-mac-bcbcdd4603d4 8/8