How To Create EXE File Using Python
Concept & Code
Step 1: > pip install pyinstaller
Step 2:
Create one python file "test.py"
import tkinter as tk
from tkinter import simpledialog
root = tk.Tk()
root.withdraw()
user_name = simpledialog.askstring(title="MyApp", prompt="What's your Username?:")
Step 3: > pyinstaller test.py --onefile
Now Your EXE will be created and it is ready to be used.
# Advanced Section
you can edit your test.spec file as per your requirement
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['test.py'],
pathex=['C:\\Users\\kuntal\\Desktop\\ICSS\\ICSS\\Advanced
Python\\Threading & Parameter Parsing\\Build Windows application'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='test',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False )
Now after all changes run the following command to re-create EXE again
> pyinstaller test.spec --onefile
Go to newly created 'dict' folder and check your EXE is ready
Screenshot :
Create Your Own .exe and Enjoy 👍
It's help me a lot but can you tell me how can create desktop shortcut?
ReplyDeleteSurely I will definitely create a content for this and let you know. Please do share
Deletei am working on same thing i might help on this content. i will show you as soon as possible
Delete