ED LEIJNSE
  • Home
    • Contact >
      • Privacy
  • Photo Projects
    • Camila
    • Christy
  • Hans Glanzmann
  • Disclaimer
  • Photolaundry
  • Corona
  • Python
  • TAGGER.BIZ SUPPORT
  • TAGGER.BIZ
    • Demo TAGGER.biz
  • Once upon a time in London
  • Photoblog
  • Outside
    • Los Pensionados
    • Clouds
    • Zürich 2017
    • Luzern >
      • Sing for Australia
    • Locarno 2020
    • Bern 2020
    • Nightshots at Zürich West
    • Lausanne 2020
  • Studio
    • Ivana
    • Demi Fray
    • Paulina Brown
    • Viadukt Jenseits
    • Giuliana
  • Photolaundry 2021

How to deploy PY script on a Mac

16/3/2021

0 Comments

 
If you've already installed "pyinstaller" (with pip install pyinstaller) you can run following command:
sudo pyinstaller YourPythonScript.py -n YourPythonScriptName --clean  --onefile
What happens: a Unix executable "YourPythonScriptName" will be created in the /dist directory.
It's just ONE FILE, no worries about security issues anymore.

Here is the complete article:

Mr. NetTek explains: how to deploy a Python script with pyinstaller on a mac

NOTE: THIS ARTICLE IS WRITTEN BY MrNetTek, click on the link above to see the original text.
Mac – pyinstaller – Create .APP FilePosted onMarch 15, 2019AuthorMrNetTek

PyInstaller reads a Python script written by you. It analyzes your code to discover every other module and library your script needs in order to execute. Then it collects copies of all those files – including the active Python interpreter! – and puts them with your script in a single folder, or optionally in a single executable file, and an APP.
Install
pip3 install pyinstaller

Compile
1sudo pyinstaller Notify.py -n Notify --windowed --noconfirm --clean

Other packages/dependencies you may need before compiling:
xcode-select –install
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
brew install python3
brew link python
brew postinstall python
pip3 install -U py2app

pip3 install Pillow
brew install tcl-tk
pip3 install virtualenv
brew install pyside
pip3 install sip
brew install cartr/qt4/pyqt@4
brew install PyQt5
brew install opencv@2
brew install git

pip3 install opencv-python
pip install python-resize-image




Options
If you specify only --onefile under Mac OS X, the output in dist is a UNIX executable myscript. It can be executed from a Terminal command line. Standard input and output work as normal through the Terminal window.
If you also specify --windowed, the dist folder contains two outputs: the UNIX executable myscript and also an OS X application named myscript.app.
As you probably know, an application is a special type of folder. The one built by PyInstaller contains a folder always named Contents. It contains:
“
  • A folder Frameworks which is empty.
  • A folder MacOS that contains a copy of the same myscript UNIX executable.
  • A folder Resources that contains an icon file.
  • A file Info.plist that describes the app.

PyInstaller builds minimal versions of these elements.
Use the icon= argument to specify a custom icon for the application. (If you do not specify an icon file, PyInstaller supplies a file icon-windowed.icns with the PyInstaller logo.)
Notes
https://pyinstaller.readthedocs.io/en/v3.3.1/operating-mode.html
https://realpython.com/pyinstaller-python/

0 Comments



Leave a Reply.

    Author

    Ed Leijnse
    Graphic design
    Photography
    ​
    Software Development
    C#, Java, Python
    Wordpress
    websites
    ​https://tagger.biz
    ​https://paparazzi.li
    https://leijnse.info

    Archives

    July 2021
    March 2021

    Categories

    All
    Classes
    Collections
    Deployment
    Gui
    Programming
    Pyinstaller
    Python
    Ti-84
    Ti-84 Python Edition

    RSS Feed

  • Home
    • Contact >
      • Privacy
  • Photo Projects
    • Camila
    • Christy
  • Hans Glanzmann
  • Disclaimer
  • Photolaundry
  • Corona
  • Python
  • TAGGER.BIZ SUPPORT
  • TAGGER.BIZ
    • Demo TAGGER.biz
  • Once upon a time in London
  • Photoblog
  • Outside
    • Los Pensionados
    • Clouds
    • Zürich 2017
    • Luzern >
      • Sing for Australia
    • Locarno 2020
    • Bern 2020
    • Nightshots at Zürich West
    • Lausanne 2020
  • Studio
    • Ivana
    • Demi Fray
    • Paulina Brown
    • Viadukt Jenseits
    • Giuliana
  • Photolaundry 2021