How to make a python script into a standalone executable ?

Posted by Afsal on 24-Mar-2023

Hi Pythonistas!

Today we will learn how to make an executable from a python script. We are using a package called pyinstaller. This package has support in Windows, Linux, and mac. Let us div into the code


pip install pyinstaller

For the script I am using the same code as the previous post.


from faker import Faker
fake = Faker(['ja_JP'])

for _ in range(10):


pyinstaller --onefile --name fakerexecutable

name is an optional parameter if we don't pass the name executable has also named as the script.

onefile is an optional parameter if it passed the final output will be single file with all the dependencies are packed else it will be folder

Once the command is executed then a dist folder will be created inside there will be our executable.

Run executable

If you are using unix like OS we can run by


If you are using window we run by double clicking the file


佐藤 裕美子
橋本 和也
中島 浩
吉田 幹
林 翔太
太田 英樹
佐藤 知実
山本 花子
山口 七夏
佐々木 香織

To learn about please visit the official documentation 

I Hope you have learned something from the post. Please share you valuable suggestions with