Pyinstaller Import Module



  1. Pyinstaller Import Module Command
  2. Pyinstaller Import External Module
  3. Pyinstaller Import All Modules
  4. Pyinstaller Import Module At Runtime
  5. Pyinstaller Spec File Example

Help keeping PyInstaller alive:Maintaining PyInstaller is a huge amount of work.PyInstaller development can only continueif users and companies provide sustainable funding.See Funding PyInstaller for how to support PyInstaller.

In most cases, PyInstaller is able to analyze your project and automatically determine what modules to place in the bundle. But, if PyInstaller happens to miss a module, you can use the -hidden-import MODULENAME flag to explicitly instruct PyInstaller to include a module. See the PyInstaller documentation for more details.

  • Mac及びWindows10で、Pyinstallerを使ってPythonコードから生成した実行ファイルを動かしたら、ModuleNotFoundErrorが発生しました。それを回避した時の記録です。 手順.
  • The main goal of PyInstaller is to be compatible with 3rd-party packages out-of-the-box. This means that, with PyInstaller, all the required tricks to make external packages work are already integrated within PyInstaller itself so that there is no user intervention required.
  • Now that we have PyInstaller installed in our system, we can used it to create a standalone application. However, before we do so, let’s just add PyInstaller to the PATH. In order to do so, add C: Users user AppData Local Programs Python Python36-32 Scripts to the Path environment variable. With PyInstaller in the PATH, we are ready to move on.
  • Packaging of Python programs into standard executables, that workon computers without Python installed.

  • Multi-platform: works under

    • Windows (32-bit and 64-bit),

    • GNU/Linux (32-bit and 64-bit),

    • Mac OS X (32-bit and 64-bit),

    • contributed suppport for FreeBSD, Solaris, HPUX, and AIX.

  • Multi-version: supports Python 2.7 and Python 3.5—3.7.

  • Flexible packaging mode:

    • Single directory: build a directory containing an executable plusall the external binary modules (.dll, .pyd, .so) used by theprogram.

    • Single file: build a single executable file, totallyself-contained, which runs without any external dependency.

    • Custom: you can automate PyInstaller to do whatever packagingmode you want through a simple script file in Python.

  • Explicit intelligent support for many 3rd-packages (for hiddenimports, external data files, etc.), to make them work withPyInstaller out-of-the-box (see Supported Packages).

  • Full single-file Egg-support: required .egg files are automaticallyinspected for dependencies and bundled, and all the egg-specific featuresare supported at runtime as well (entry points, etc.).

  • Partial directory Egg-support: required .egg directories are automaticallyinspected for dependencies and bundled, but egg-specific features will notwork at runtime.

  • Automatic support for binary libraries used through ctypes(see the ctypes Dependencies Support for details).

  • Support for automatic binary packing through the well-knownUPX compressor.

  • Optional console mode (see standard output and standard error atruntime).

Windows-specific features¶

  • Support for code-signing executables (see Recipe Win Code Signing fordetails).

  • Full automatic support for CRTs: no need to manually distributeMSVCR*.DLL, redist installers, manifests, or anything else; trueone-file applications that work everywhere! (But see the restrictionwhen building on Windows 10.)

  • Selectable executable icon.

  • Fully configurable version resource section and manifests inexecutable.

  • Configurable .exe requirement running as administrator - UAC admin.

Mac-specific features¶

  • Support for .app bundles.

  • Support for code-signing: created .app bundles can be signed bycodesign (see Recipe OSX Code Signing for details.

Help keeping PyInstaller alive:Maintaining PyInstaller is a huge amount of work.PyInstaller development can only continueif users and companies provide sustainable funding.See Funding PyInstaller for how to support PyInstaller.

ctypes Dependencies Support¶

ctypes is a foreign function library for Python, that allows callingfunctions present in shared libraries. Those libraries are not imported asPython packages, because they are not picked up via Python imports: their pathis passed to ctypes instead, which deals with the shared library directly;this caused <1.4 PyInstaller import detect machinery to miss those libraries,failing the goal to build self-contained PyInstaller executables:

Solution in PyInstaller¶

PyInstaller contains a pragmatic implementation of ctypes dependencies: itwill search for simple standard usages of ctypes and automatically track andbundle the referenced libraries. The following usages will be correctlydetected:

Pyinstaller

More in detail, the following restrictions apply:

  • Only libraries referenced by bare filenames (e.g. no leading paths) willbe handled. Handling absolute paths would be impossible without modifyingthe bytecode as well (remember that while running frozen, ctypes would keepsearching the library at that very absolute location, whose presence on thehost system nobody can guarantee), and relative paths handling would requirerecreating in the frozen executable the same hierarchy of directoriesleading to the library, in addition of keeping track of which the currentworking directory is;

  • Only library paths represented by a literal string will be detected andincluded in the final executable PyInstaller import detection works byinspecting raw Python bytecode, and since you can pass the library path toctypes using a string (that can be represented by a literal in the code, butalso by a variable, by the return value of an arbitrarily complex function,etc…), it’s not reasonably possible to detect allctypes dependencies;

  • Only libraries referenced in the same context of `ctypes’` invocation willbe handled.

Pyinstaller

We feel that it should be enough to cover most ctypes’ usages, with littleor no modification required in your code. If you think, PyInstaller shoulddo more by itself, please help improvingPyInstaller.

Restrictions¶

Import

The ctypes detect system at Analysis() time is based onctypes.util.find_library(). This means that you have to make sure thatwhile performing Analysis() and running frozen, all the environment valuesfind_library() uses to search libraries are aligned to those when runningun-frozen. Examples include using LD_LIBRARY_PATH orDYLD_LIBRARY_PATH to widen find_library scope.

Latest version

Released:

Use pyinstaller in your setup.py

Project description

Project details


Release historyRelease notifications | RSS feed

2019.3

Import

2019.2

2019.1

2019.0

Pyinstaller Import Module Command

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyinstaller-setuptools, version 2019.3
Filename, sizeFile typePython versionUpload dateHashes
Filename, size pyinstaller_setuptools-2019.3-py3-none-any.whl (3.7 kB) File type Wheel Python version py3 Upload dateHashes
Filename, size pyinstaller_setuptools-2019.3.tar.gz (2.3 kB) File type Source Python version None Upload dateHashes
Close

Pyinstaller Import External Module

Hashes for pyinstaller_setuptools-2019.3-py3-none-any.whl

Hashes for pyinstaller_setuptools-2019.3-py3-none-any.whl
AlgorithmHash digest
SHA25645332453b24b957de88766726104b3dc7dea5d6a6ef56e9bc1a25f53450727d1
MD555f326c39fc828ec5ea4fb1a1dc2f69f
BLAKE2-2565ee5bf940de8d3869d5f17492493fb0527ca62ca9e4b8207b4da914baf1f51eb

Pyinstaller Import All Modules

Close

Pyinstaller Import Module At Runtime

Hashes for pyinstaller_setuptools-2019.3.tar.gz

Pyinstaller Spec File Example

Hashes for pyinstaller_setuptools-2019.3.tar.gz
AlgorithmHash digest
SHA2568028e9214cf53f99dd7eaa647da751f92e0446b45900987bc1c58f58e371c047
MD52f1386b3b26287b5f5527d8c94b85c2a
BLAKE2-2564fbbe4c88f3ddc8ceccdb12017f063b3a3f67b2143ddc4066f436345a3e3c0de