Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Contributor: CovertBotNews - Introducing PyInstaller
#1
Introducing PyInstaller

<div data-history-node-id="1339871" class="layout layout--onecol">
<div class="layout__region layout__region--content">

<div class="field field--name-field-node-image field--type-image field--label-hidden field--item"> <img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/flat%2C750x1000%2C075%2Ct.jpg" width="450" height="600" alt="""" typeof="foaf:Image" class="img-responsive" /></div>

<div class="field field--name-node-author field--type-ds field--label-hidden field--item">by <a title="View user profile." href="https://www.linuxjournal.com/user/1000891" lang="" about="https://www.linuxjournal.com/user/1000891" typeof="schemaTongueerson" property="schema:name" datatype="" xml:lang="">Reuven M. Lerner</a></div>

<div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p><em>Want to distribute Python programs to your Python-less clients?
PyInstaller is the answer.</em></p>

<p>
If you're used to working with a compiled language, the notion
that you would need to have a programming language around, not just for
development but also for running an application, seems a bit weird.
Just because a program was written in C doesn't mean you need a C
compiler in order to run it, right?
</p>

<p>
But of course, interpreted and byte-compiled languages do require
the original language, or a version of it, in order to run. True, Java
programs are compiled, but they're compiled into bytecodes then
executed by the JVM. Similarly, .NET programs cannot run unless the
CLR is present.
</p>

<p>
Even so, many of the students in my Python courses are surprised to
discover that if you want to run a Python program, you need to have
the Python language installed. If you're running Linux, this
isn't a problem. Python has come with every distribution I've used
since 1995. Sometimes the Python version isn't as modern as I'd like,
but the notion of "this computer can't run Python programs" isn't
something I've had to deal with very often.
</p>

<p>
However, not everyone runs Linux, and not everyone's computer has
Python on it. What can you do about that? More specifically, what
can you do when your clients don't have Python and aren't interested
in installing it? Or what if you just want to write and distribute an
application in Python, without bothering your users with additional
installation requirements?
</p>

<p>
In this article, I discuss <a href="https://pyinstaller.readthedocs.io">PyInstaller</a>, a cross-platform tool that
lets you take a Python program and distribute it to your users,
such that they can treat it as a standalone app. I also discuss
what it doesn't do, because many people who think about using
PyInstaller don't fully understand what it does and doesn't
do.
</p>


<h3>Running Python Code</h3>

<p>
Like Java and .NET, Python programs are compiled into bytecodes, high-level commands that don't correspond to the instructions
of any actual computer, but that reference something known as a
"virtual machine". There are a number of substantial differences
between Java and Python though. Python doesn't have an explicit
compilation phase; its bytecodes are pretty high level and connected
to the Python language itself, and the compiler doesn't do that much
in terms of optimization. The correspondence between Python source
code and the resulting bytecodes is basically one-to-one; you won't find
the bytecode compiler doing fancy things like inlining code or
optimizing loops.
</p></div>

<div class="field field--name-node-link field--type-ds field--label-hidden field--item"> <a href="https://www.linuxjournal.com/content/introducing-pyinstaller" hreflang="en">Go to Full Article</a>
</div>

</div>
</div>




https://www.linuxjournal.com/content/int...yinstaller
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)