How to Install python-barcode in Python

v0.16.1 CLI & Utilities Python >=3.9 MIT

Create standard barcodes with Python. No external modules needed. (optional Pillow support included).

Install pip install python-barcode

What is python-barcode?

Create standard barcodes with Python. No external modules needed. (optional Pillow support included).

python-barcode provides a simple way to create barcodes in Python.

There are no external dependencies when generating SVG files. Pillow is required for generating images (e.g.: PNGs).

You can build the documentation locally using ``.

Quick Start

Minimal example to get started with python-barcode:

import barcode

print(barcode.__version__)

Installation

pip (standard)

pip install python-barcode

Virtual environment (recommended)

python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate
pip install python-barcode

pip3

pip3 install python-barcode

conda

conda install -c conda-forge python-barcode

Poetry

poetry add python-barcode

Verify the Installation

After installing, confirm the package is available:

python -c "import barcode; print(barcode.__version__)"

If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.

Installation Errors

Common errors when installing python-barcode with pip.

ModuleNotFoundError: No module named 'barcode'

Cause: The package is not installed in the current Python environment.

Fix: Run pip install python-barcode. If using a virtual environment, ensure it is activated first.

ModuleNotFoundError: No module named 'barcode' (installed but still failing)

Cause: pip installed the package into a different Python than the one running your script.

Fix: Use python -m pip install python-barcode to install into the interpreter you are running.

ImportError: cannot import name 'X' from 'barcode'

Cause: The function or class does not exist in the installed version.

Fix: Check the version with pip show python-barcode and upgrade with pip install --upgrade python-barcode.

pip: command not found

Cause: pip is not in PATH or Python was not added to PATH during installation.

Fix: Try python -m pip install python-barcode. On macOS/Linux try pip3.

PermissionError: [Errno 13] Permission denied

Cause: No write access to the system Python package directory.

Fix: Use a virtual environment, or add --user: pip install --user python-barcode

SSL: CERTIFICATE_VERIFY_FAILED

Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.

Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org python-barcode

Recent Releases

VersionReleased
0.16.0 2025-08-27
0.16.1 latest 2025-08-27
0.15.1 2023-07-05
0.14.0 2022-05-17
0.13.1 2020-08-18

Full release history on PyPI →

Manage python-barcode

Upgrade to latest version

pip install --upgrade python-barcode

Install a specific version

pip install python-barcode==0.16.1

Uninstall

pip uninstall python-barcode

Check what is installed

pip show python-barcode

Last updated: 2026-04-11 • Data from PyPI