You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/shipping/freezing.rst
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,6 +117,50 @@ py2app
117
117
PyInstaller
118
118
~~~~~~~~~~~
119
119
120
+
PyInstaller can be used to build Unix executables and windowed apps on Mac OS X 10.6 (Snow Leopard) or newer.
121
+
122
+
To install PyInstaller, use pip:
123
+
124
+
.. code-block:: console
125
+
126
+
$ pip install pyinstaller
127
+
128
+
To create a standard Unix executable, from say :code:`script.py`, use:
129
+
130
+
.. code-block:: console
131
+
132
+
$ pyinstaller script.py
133
+
134
+
This creates,
135
+
136
+
- a :code:`script.spec` file, analogous to a :code:`make` file
137
+
- a :code:`build` folder, that holds some log files
138
+
- a :code:`dist` folder, that holds the main executable :code:`script`, and some dependent Python libraries,
139
+
140
+
all in the same folder as :code:`script.py`. PyInstaller puts all the Python libraries used in :code:`script.py` into the :code:`dist` folder, so when distributing the executable, distribute the whole :code:`dist` folder.
141
+
142
+
The :code:`script.spec` file can be edited to `customise the build <http://pythonhosted.org/PyInstaller/#spec-file-operation>`_, with options such as
143
+
144
+
- bundling data files with the executable
145
+
- including run-time libraries (:code:`.dll` or :code:`.so` files) that PyInstaller can't infer automatically
146
+
- adding Python run-time options to the executable,
147
+
148
+
Now :code:`script.spec` can be run with :code:`pyinstaller` (instead of using :code:`script.py` again):
149
+
150
+
.. code-block:: console
151
+
152
+
$ pyinstaller script.spec
153
+
154
+
To create a standalone windowed OS X application, use the :code:`--windowed` option
155
+
156
+
.. code-block:: console
157
+
158
+
$ pyinstaller --windowed script.spec
159
+
160
+
This creates a :code:`script.app` in the :code:`dist` folder. Make sure to use GUI packages in your Python code, like `PyQt <https://riverbankcomputing.com/software/pyqt/intro>`_ or `PySide <http://wiki.qt.io/About-PySide>`_, to control the graphical parts of the app.
161
+
162
+
There are several options in :code:`script.spec` related to Mac OS X app bundles `here <http://pythonhosted.org/PyInstaller/#spec-file-options-for-a-mac-os-x-bundle>`_. For example, to specify an icon for the app, use the :code:`icon=\path\to\icon.icns` option.
0 commit comments