3

How do I import pyBarcode from the Python interpreter? According to the pyBarcode documentation the first step is to import barcode. When I try that it says there is no such module.

~# python
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48)
[GCC 4.4.5] on linux2

>>> import barcode
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named barcode
ram1
  • 6,290
  • 8
  • 41
  • 46

2 Answers2

5

Before using (importing) pyBarcode, you must install it, for instance with

pip install pyBarcode
phihag
  • 278,196
  • 72
  • 453
  • 469
5

Make sure that the directory that contains the module is in your PYTHONPATH environment variable.

Alternatively, you can use

import sys
sys.path.append(r"C:\path to pyBarcode")
import barcode
TorelTwiddler
  • 5,996
  • 2
  • 32
  • 39