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 .
use pyinstaller to package executable on windows 10
Tips:
if we use pyinstaller -y -D demo.py don’t include —path="sdk/superdog" ,
package will be missing, and error occur when we run executable.
all related dlls have been copied to dist/demo/ folder,
eg. cublas64_80.dll,curand64_80.dll,cudart64_80.dll,cudnn64_6.dll
use ctype DLLs
path related source code
CDLL related source code
Tips: for CDLL with pyinstaller, we must use bare filenames in python source.
see here
now we run pyintaller again
superdog and detect.
all related dlls have been copied to dist/demo/ folder,
eg. cublas64_80.dll,curand64_80.dll,cudart64_80.dll,cudnn64_6.dll
and cuda80_detect_cpp_dll.dll
Version
get version
set version
Advanced
Running PyInstaller with Python optimizations
Tips: be carefull with optimizations.
PyInstaller can be run with Python optimization flags ( -O or -OO )
by executing it as a Python module, rather than using the pyinstaller command:
Or, by explicitly setting the PYTHONOPTIMIZE environment variable to a non-zero value:
only import what you need
replace import os with from os import path to reduce final executable size.
Using UPX
Encrypting Python Bytecode
To encrypt the Python bytecode modules stored in the bundle, pass the —key=key-string argument on the command line.
For this to work, you must have the PyCrypto module installed. The key-string is a string of 16 characters which is used to encrypt each file of Python byte-code before it is stored in the archive inside the executable file.
Name already in use
pyinstaller / doc / installation.rst
- Go to file T
- Go to line L
- Copy path
- Copy permalink
- Open with Desktop
- View raw
- Copy raw contents Copy raw contents
Copy raw contents
Copy raw contents
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 :ref:`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)
- GNU/Linux: /usr/bin/
- 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.
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.