PyInstaller is a versatile tool that bundles a Python application and all its dependencies into a single package, often a standalone executable. This allows distribution of Python applications to users without requiring them to install a Python interpreter or any modules. The current version is 6.19.0, and the project typically releases minor versions every 2-3 months and major versions annually.
pip install pyinstallerNo compatibility data collected yet for this library.
PyInstaller is primarily a command-line tool. This example demonstrates how to create a simple Python script and the typical command used to bundle it into a standalone executable. After running `pyinstaller my_app.py` in your terminal, a `dist` folder will be created containing the executable.
Always check PyInstaller's `requires_python` metadata (e.g., on PyPI) or the official documentation for the version you intend to use. Ensure your Python environment meets the requirements before upgrading PyInstaller.
Adopt the new syntax: `--add-data SOURCE_PATH{os.pathsep}DEST_PATH` (or explicitly `SOURCE_PATH:DEST_PATH` for Unix-like or `SOURCE_PATH;DEST_PATH` for Windows) and ensure the separator matches the target platform for cross-platform builds. For example, `pyinstaller --add-data 'my_data.txt:.' my_app.py`Use the `--hidden-import` option to explicitly tell PyInstaller about modules it should include (e.g., `pyinstaller --hidden-import=sklearn.utils my_app.py`). For more complex scenarios, consider writing custom hook files or reviewing PyInstaller's extensive list of built-in hooks for popular libraries.
If possible, distribute with `--onedir` (a directory containing the executable and its dependencies), which is less prone to false positives. For `--onefile` applications, you may need to instruct users to create an antivirus exception or digitally sign your executable, although signing does not guarantee avoidance of all false positives.
Run the executable from the command line (e.g., `my_app.exe` on Windows or `./my_app` on macOS/Linux) or re-bundle without the `--windowed` option to see the detailed Python traceback, which will reveal the underlying error. Alternatively, add `--debug` during the build process to get more verbose output during execution.
Add the missing module explicitly using the `--hidden-import <module_name>` option in your PyInstaller command (e.g., `pyinstaller --onefile --hidden-import='pandas.io.excel._openpyxl' your_script.py`). Ensure PyInstaller is run from a virtual environment where all necessary packages are installed.
Include data files using the `--add-data 'source;destination'` option (e.g., `pyinstaller --add-data 'images/*.png;images' your_script.py`) or by modifying the `.spec` file's `datas` array. Always use relative paths within your script to refer to these bundled files.
Try updating `pyinstaller` and `pyinstaller-hooks-contrib` to their latest versions: `pip install --upgrade pyinstaller pyinstaller-hooks-contrib`. If the issue persists, consider downgrading the problematic third-party library or checking PyInstaller's documentation/GitHub issues for a specific workaround or a custom hook for that module.
No dependency data recorded yet.