This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Blog: PyInstaller - Distributing Python Code

Installation and Setup

Pyinstaller is an ordinary python bundle. It very well may be introduced to installed pip:

pip introduce pyinstaller

Installation in Windows

For Windows, pywin32 or pypiwin32 is essential. The last is introduced consequently when pyinstaller is introduced installed pip.

Installation in Mac OS X

PyInstaller works with the default Python 2.7 gave current Mac OS X. In the event that later forms of Python are to be utilized or if any significant bundles, for example, PyQT, Numpy, Matplotlib and such are to be utilized, it is prescribed to install them utilizing either MacPorts or Homebrew.

Installing from the archive

In the event that pip isn't accessible, download the packed document from PyPI. To test the improvement rendition, download the packed chronicle from the create part of PyInstaller Downloads page.

Grow the document and discover the setup.py content. Execute python setup.py introduce with head benefit to introduce or overhaul PyInstaller.

Verifying the installation

The command pyinstaller should exist on the framework way for all stages after an effective installation.

Confirm it by composing pyinstaller - form in the direct line. This will print the present variant of pyinstaller

Using Pyinstaller

In the most straightforward use-case, simply explore to the registry your document is in, and type:

pyinstaller myfile.py

Pyinstaller examines the record and makes:

  • A myfile.spec file in the same directory as myfile.py
  • A build folder in the same directory as myfile.py
  • A dist folder in the same directory as myfile.py
  • Log files in the build folder

The bundled application can be found in the dist folder

Alternatives

There are a few alternatives that can be utilized with pyinstaller. A full rundown of the choices can be found here. Once bundled your application can be controlled by opening 'dist\myfile\myfile.exe'

Bundling to One Folder

At the point when PyInstaller is utilized with no choices to bundle myscript.py , the default yield is a single folder (named myscript) containing an executable named myscript (myscript.exe in windows) alongside all the vital conditions.

The application can be appropriated by packing the folder into a zip file.

One Folder mode can be explicitly set using the option -D or --onedir

pyinstaller myscript.py -D

Advantages

One of the real favorable circumstances of packaging to a solitary organizer is that it is less demanding to investigate issues. On the off chance that any modules neglect to import, it tends to be confirmed by investigating the folder.

Another preferred standpoint is felt amid updates. On the off chance that there are a couple of changes in the code yet the conditions utilized are the very same, wholesalers can simply transport the executable record (which is regularly littler than the whole organizer).

Disadvantages

The only disadvantage of this method is that the users have to search for the executable among a large number of files.

Also users can delete/modify other files which might lead to the app not being able to work correctly.

Bundling to a Single File

pyinstaller myscript.py -F

The options to generate a single file are -F or --onefile. This bundles the program into a single myscript.exe file. Single file executable are slower than the one-folder bundle. They are also harder to debug

python pyinstaller python code blog

Hello Manoj Yarramsetti!

We believe that this post does not fit the main topic of this site.

This appears to be off-topic.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.