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
4
  • Can you successfully import barcode from a script? Commented Jul 5, 2011 at 18:49
  • You need to install the module first, it's not included with Python. Commented Jul 5, 2011 at 18:49
  • Oops I hadn't installed it. Now I have. Resolved. Commented Jul 5, 2011 at 18:54
  • +1 for including full traceback Commented Jul 5, 2011 at 18:56

2 Answers 2

5

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

pip install pyBarcode
Sign up to request clarification or add additional context in comments.

2 Comments

The link no longer works, you should provide the answer not only a link.
Thanks for the note, I updated the link and added the installation instructions.
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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.