pylibmagic is a lightweight Python package designed to simplify the installation and usage of the `libmagic` C library. It provides pre-compiled `libmagic` shared libraries via Python wheels, primarily addressing the common `ImportError: failed to find libmagic` encountered when using other `libmagic` bindings like `python-magic`. The current version is 0.5.0, with releases focusing on expanding Python version and architecture support.
pip install pylibmagicVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `pylibmagic` in conjunction with the `python-magic` library. `pylibmagic` ensures that the `libmagic` C library is available for `python-magic` to use, solving common installation issues. After importing `pylibmagic`, you can then proceed to use the `magic` module from `python-magic` as intended.
Ensure both `pylibmagic` and `python-magic` are installed: `pip install pylibmagic python-magic`.
On Debian/Ubuntu, install `libmagic1` or `libmagic-dev` (`sudo apt-get install libmagic1`). On macOS, install via Homebrew (`brew install libmagic`). For Windows, `python-magic-bin` might be a more robust solution, or ensure `libmagic` DLLs are correctly placed and match your Python's bitness.
Ensure that the `libmagic` DLLs and your Python installation are both either 32-bit or 64-bit. Consider using `pip install python-magic-bin` which often includes the correct binaries for Windows.
No dependency data recorded yet.