Installation
Installation of Aspose.BarCode FOSS for Python
Aspose.BarCode FOSS for Python is distributed as a pure-Python package on PyPI. There are no native extensions to compile, no system libraries to install, and no third-party runtime required.
Prerequisites
| Requirement | Detail |
|---|---|
| Python version | 3.12 or later |
| Package manager | pip (bundled with CPython) |
| Operating system | Windows, macOS, Linux (any platform that runs CPython) |
| Compiler / build tools | None required |
| System packages | None required |
1. Install via pip
The simplest way to install Aspose.BarCode FOSS is directly from PyPI:
pip install aspose-barcode-fosspip will download and install the package. No post-install configuration is needed.
To install a pinned version for reproducible builds:
pip install aspose-barcode-foss==0.1.02. Set Up a Virtual Environment
Using a virtual environment keeps the library isolated from other Python projects.
Create and activate a virtual environment:
# Create the environment
python -m venv .venv
# Activate on Linux / macOS
source .venv/bin/activate
# Activate on Windows (Command Prompt)
.venv\Scripts\activate.bat
# Activate on Windows (PowerShell)
.venv\Scripts\Activate.ps1Install the library inside the activated environment:
pip install aspose-barcode-fossRecord dependencies for reproducibility:
pip freeze > requirements.txt3. Verify the Installation
After installing, verify that the library imports correctly:
import aspose_barcode_foss as barcode
bc = barcode.code128("TEST")
print(f"Generated barcode with {bc.symbol.matrix.width}x{bc.symbol.matrix.height} modules")You can also check the installed version with pip:
pip show aspose-barcode-fossThis prints the version, author, and license (MIT).
Quick Start: Generate a Barcode
The following script generates a Code 128 barcode and saves it as SVG:
import aspose_barcode_foss as barcode
from aspose_barcode_foss import RenderOptions
bc = barcode.code128("Hello World")
svg = bc.to_svg(options=RenderOptions(show_text=True))
with open("barcode.svg", "w") as f:
f.write(svg)
print("Saved barcode.svg")Generate a QR code and save it as PNG:
import aspose_barcode_foss as barcode
from aspose_barcode_foss import QrOptions, QrErrorCorrectionLevel
bc = barcode.qr(
"https://example.com",
encode=QrOptions(error_correction_level=QrErrorCorrectionLevel.H),
)
with open("qr.png", "wb") as f:
f.write(bc.to_png())
print("Saved qr.png")Platform Notes
Windows, macOS, Linux: The library is identical on all platforms. There are no platform-specific code paths or binary extensions.
Docker / serverless: Because there are no system-package dependencies, the library works inside slim Docker images (such as python:3.12-slim) without installing additional packages.
CI/CD: Add pip install aspose-barcode-foss to your CI pipeline’s dependency step. No additional setup is required.
Next Steps
- Quickstart: First working barcode with encode and render options
- License: MIT license details
- Developer Guide: Per-symbology encode options, rendering controls, and code examples