A list of ways python apps can be packaged for distribution
Example command below, check the pyinstaller documentation for more clarity
pyinstaller \
--clean \
-n Kaushal_TTS \
--add-data country_locale.csv:country_locale.csv \
--paths /Users/kaushal/.local/share/virtualenvs/streamlit-edge-tts-pciHd8Fx/lib/python3.11/site-packages \
--collect-data streamlit \
--collect-data edge_tts \
--copy-metadata streamlit \
--copy-metadata numpy \
--copy-metadata pandas \
--copy-metadata edge_tts \
--copy-metadata importlib_metadata \
main.py
Note this is also OS dependent Hence virtualenv from macos won't work on Windows. create the virtualenv on Windows itself using Pipfile or requirements and then follow the below steps
- go to the location of the virtual env - in this case it was /Users/kaushal/.local/share/virtualenvs/streamlit-edge-tts-pciHd8Fx/*
- Zip this folder using the comman -
zip -r <name_of_project> streamlit-edge-tts-pciHd8Fx/*
- copy the created zip to some other folder
- unzip the zip
- copy and paste the scripts of the project in this unzipped folder where the folder
bin
,lib
,etc
,pyvene.cfg
(if pipenv) exists. - to run the project type the following command where
bin
folder exists -bin/python -m streamlit run main.py
(for streamlit app) - Create a
.sh
file for executing step 6 for linux/macos and a.bat
file for windows