Skip to content

Commit a59e637

Browse files
committed
PyInstaller
1 parent be73b37 commit a59e637

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3455,6 +3455,18 @@ cdef enum <enum_name>: <member_name_1>, <member_name_2>, ...
34553455
```
34563456

34573457

3458+
PyInstaller
3459+
-----------
3460+
```bash
3461+
$ pip3 install pyinstaller
3462+
$ pyinstaller script.py # Compiles into './dist/script' directory.
3463+
$ pyinstaller script.py --onefile # Compiles into './dist/script' console app.
3464+
$ pyinstaller script.py --windowed # Compiles into './dist/script' windowed app.
3465+
$ pyinstaller script.py --add-data '<path>:.' # Adds file to the root of the executable.
3466+
```
3467+
* **Paths of files have to be changed to `'os.path.join(sys._MEIPASS, "<path>")'`.**
3468+
3469+
34583470
Basic Script Template
34593471
---------------------
34603472
```python

index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2930,6 +2930,16 @@
29302930
</code></pre>
29312931
<pre><code class="python language-python hljs">cdef enum &lt;enum_name&gt;: &lt;member_name_1&gt;, &lt;member_name_2&gt;, ...
29322932
</code></pre>
2933+
<div><h2 id="pyinstaller"><a href="#pyinstaller" name="pyinstaller">#</a>PyInstaller</h2><pre><code class="bash language-bash hljs">$ pip3 install pyinstaller
2934+
$ pyinstaller script.py <span class="hljs-comment"># Compiles into './dist/script' directory.</span>
2935+
$ pyinstaller script.py --onefile <span class="hljs-comment"># Compiles into './dist/script' console app.</span>
2936+
$ pyinstaller script.py --windowed <span class="hljs-comment"># Compiles into './dist/script' windowed app.</span>
2937+
$ pyinstaller script.py --add-data <span class="hljs-string">'&lt;path&gt;:.'</span> <span class="hljs-comment"># Adds file to the root of the executable.</span>
2938+
</code></pre></div>
2939+
2940+
<ul>
2941+
<li><strong>Paths of files have to be changed to <code class="python hljs"><span class="hljs-string">'os.path.join(sys._MEIPASS, "&lt;path&gt;")'</span></code>.</strong></li>
2942+
</ul>
29332943
<div><h2 id="basicscripttemplate"><a href="#basicscripttemplate" name="basicscripttemplate">#</a>Basic Script Template</h2><pre><code class="python language-python hljs"><span class="hljs-comment">#!/usr/bin/env python3</span>
29342944
<span class="hljs-comment">#</span>
29352945
<span class="hljs-comment"># Usage: .py</span>

0 commit comments

Comments
 (0)