xxxxxxxxxx
'''
Assuming you want to run the file like this: ./script.py
use the shebang (#!)
and tell the location of the interpreter
example:
1) #!/path/to/project/venv/bin/python (if using virtual env)
2) #!/usr/bin/env python
'''
xxxxxxxxxx
# Open Windows Command Prompt and install pyinstaller
pip install pyinstaller
# This will create a folder called dist that contains the executable file hello.exe.
pyinstaller hello.py
# This will create a single hello.exe file in the dist folder that contains all the necessary code and resources.
pyinstaller --onefile hello.py
# If you want to hide the console window when running the executable file.
pyinstaller --noconsole --onefile hello.py
xxxxxxxxxx
##### Sol_1
import subprocess
subprocess.call(["path_to_exe.exe",'parameter_1','parameter_2'])
##### Sol_2
import os
os.startfile("path_to_exe.exe",'parameter_1','parameter_2')
xxxxxxxxxx
# install the libraries
pip install auto-py-to-exe
#start the gui-application
auto-py-to-exe
xxxxxxxxxx
import PyInstaller.__main__
PyInstaller.__main__.run([
'my_script.py',
'--onefile',
'--windowed'
])
#Is equivalent to: pyinstaller my_script.py --onefile --windowed
xxxxxxxxxx
pyinstaller --onefile pythonScriptName.py
# executable is created in 'dist'-folder