Pip install pyinstaller как установить

от admin

# PyInstaller — Distributing Python Code

Pyinstaller is a normal python package. It can be installed using pip:

Installation in Windows
For Windows, pywin32

(opens new window) is a prerequisite. The latter is installed automatically when pyinstaller is installed using pip.

Installation in Mac OS X
PyInstaller works with the default Python 2.7 provided with current Mac OS X. If later versions of Python are to be used or if any major packages such as PyQT, Numpy, Matplotlib and the like are to be used, it is recommended to install them using either MacPorts

Installing from the archive
If pip is not available, download the compressed archive from PyPI

(opens new window) .
To test the development version, download the compressed archive from the develop branch of PyInstaller Downloads

Expand the archive and find the setup.py script. Execute python setup.py install with administrator privilege to install or upgrade PyInstaller.

Verifying the installation
The command pyinstaller should exist on the system path for all platforms after a successful installation.
Verify it by typing pyinstaller —version in the command line. This will print the current version of pyinstaller.

# Using Pyinstaller

In the simplest use-case, just navigate to the directory your file is in, and type:

Pyinstaller analyzes the file and creates:

  • 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 app can be found in the dist folder

Options
There are several options that can be used with pyinstaller. A full list of the options can be found here

Once bundled your app can be run by opening ‘dist\myfile\myfile.exe’.

# Bundling to One Folder

When PyInstaller is used without any options to bundle myscript.py , the default output is a single folder (named myscript ) containing an executable named myscript ( myscript.exe in windows) along with all the necessary dependencies.
The app can be distributed by compressing the folder into a zip file.

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

pyinstaller myscript.py -D

# Advantages:

One of the major advantages of bundling to a single folder is that it is easier to debug problems. If any modules fail to import, it can be verified by inspecting the folder.
Another advantage is felt during updates. If there are a few changes in the code but the dependencies used are exactly the same, distributors can just ship the executable file (which is typically smaller than the entire folder).

# 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.

# Syntax
  • pyinstaller [options] script [script . ] | specfile
# Remarks

PyInstaller is a module used to bundle python apps in a single package along with all the dependencies. The user can then run the package app without a python interpreter or any modules. It correctly bundles many major packages like numpy, Django, OpenCv and others.

How to Install PyInstaller¶

PyInstaller is available as a regular Python package. The source archives for released versions are available from PyPi, but it is easier to install the latest version using pip:

To upgrade existing PyInstaller installation to the latest version, use:

To install the current development version, use:

To install directly using pip’s built-in git checkout support, use:

or to install specific branch (e.g., develop ):

Installing from the source archive¶

The source code archive for released versions of PyInstaller are available at PyPI and on PyInstaller Downloads page.

Even though the source archive provides the setup.py script, installation via python setup.py install has been deprecated and should not be used anymore. Instead, run pip install . from the unpacked source directory, as described below.

Unpack the source archive.

Move into the unpacked source directory.

Run pip install . from the unpacked source directory. If installing into system-wide python installation, administrator privilege is required.

The same procedure applies to installing from manual git checkout:

If you intend to make changes to the source code and want them to take effect immediately, without re-installing the package each time, you can install it in editable mode:

For platforms other than Windows, GNU/Linux and macOS, you must first build the bootloader for your platform: see Building the Bootloader . After the bootloader has been built, use the pip install . command to complete the installation.

Verifying the installation¶

On all platforms, the command pyinstaller should now exist on the execution path. To verify this, enter the command:

Читать:
Как смешарики оказались в космосе

The result should resemble 4.n for a released version, and 4.n.dev0-xxxxxx for a development branch.

If the command is not found, make sure the execution path includes the proper directory:

Windows: C:\PythonXY\Scripts where XY stands for the major and minor Python version number, for example C:\Python38\Scripts for Python 3.8)

macOS (using the default Apple-supplied Python) /usr/bin

macOS (using Python installed by homebrew) /usr/local/bin

macOS (using Python installed by macports) /opt/local/bin

To display the current path in Windows the command is echo %path% and in other systems, echo $PATH .

If you cannot use the pyinstaller command due to the scripts directory not being in PATH , you can instead invoke the PyInstaller module, by running python -m PyInstaller (pay attention to the module name, which is case sensitive). This form of invocation is also useful when you have PyInstaller installed in multiple python environments, and you cannot be sure from which installation the pyinstaller command will be ran.

Installed commands¶

The complete installation places these commands on the execution path:

pyinstaller is the main command to build a bundled application. See Using PyInstaller .

pyi-makespec is used to create a spec file. See Using Spec Files .

pyi-archive_viewer is used to inspect a bundled application. See Inspecting Archives .

pyi-bindepend is used to display dependencies of an executable. See Inspecting Executables .

pyi-grab_version is used to extract a version resource from a Windows executable. See Capturing Windows Version Data .

pyi-set_version can be used to apply previously-extracted version resource to an existing Windows executable.

© Copyright This document has been placed in the public domain.. Revision 4222dc4d .

pyinstaller 5.8.0

PyInstaller bundles a Python application and all its dependencies into a single package.

Навигация

Ссылки проекта

  • Homepage
  • Source

Статистика

  • Звёзд:
  • Форков:
  • Open issues:
  • Open PRs:

Метаданные

Лицензия: GNU General Public License v2 (GPLv2) (GPLv2-or-later with a special exception which allows to use PyInstaller to build and distribute non-. )

Автор: Hartmut Goebel, Giovanni Bajo, David Vierra, David Cortesi, Martin Zibricky

Метки packaging, app, apps, bundle, convert, standalone, executable, pyinstaller, cxfreeze, freeze, py2exe, py2app, bbfreeze

Требует: Python <3.12, >=3.7

Сопровождающие

Классификаторы

  • Development Status
    • 6 — Mature
    • Console
    • Developers
    • Other Audience
    • System Administrators
    • OSI Approved :: GNU General Public License v2 (GPLv2)
    • English
    • MacOS :: MacOS X
    • Microsoft :: Windows
    • POSIX
    • POSIX :: AIX
    • POSIX :: BSD
    • POSIX :: Linux
    • POSIX :: SunOS/Solaris
    • C
    • Python
    • Python :: 3
    • Python :: 3 :: Only
    • Python :: 3.7
    • Python :: 3.8
    • Python :: 3.9
    • Python :: 3.10
    • Python :: 3.11
    • Python :: Implementation :: CPython
    • Software Development
    • Software Development :: Build Tools
    • Software Development :: Interpreters
    • Software Development :: Libraries :: Python Modules
    • System :: Installation/Setup
    • System :: Software Distribution
    • Utilities

    Описание проекта

    PyInstaller bundles a Python application and all its dependencies into a single package. The user can run the packaged app without installing a Python interpreter or any modules.

    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.

    PyInstaller is tested against Windows, macOS, and GNU/Linux. However, it is not a cross-compiler: to make a Windows app you run PyInstaller in Windows; to make a GNU/Linux app you run it in GNU/Linux, etc. PyInstaller has been used successfully with AIX, Solaris, FreeBSD and OpenBSD, but is not tested against them as part of the continuous integration tests.

    How to install PyInstaller? [closed]

    This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.

    Closed 9 years ago .

    I want to use PyInstaller. I could always create bin files with pyinstaller.py [args] .

    • It’s not a package with an __init__.py file,
    • it has no setup.py
    • and it doesn’t work to create a folder, put it in my PYTHONPATH, put pyinstaller\[files] in that folder and then make a call to python pyinstaller\pyinstaller.py .

    pyinstaller.org only tells me something with Configure.py .

    So now I’m out of ideas how to install PyInstaller so that I don’t have to work with absolute paths. Do you have any ideas?

    3 Answers 3

    To install PyInstaller:

    1. Go to your command prompt (Start -> Run -> cmd)
    2. type the following command cd c:\python27\scripts press enter, this should be where your pip.exe file is located.
    3. Once you are in this directory type pip install pyinstaller press enter

    Message should read Successfully installed pyinstaller .

    Developer's user avatar

    /.wine/drive_c/Python26/Scripts/ ! PS: I am on wine in Ubuntu.

Похожие статьи