Oleg Klimenko
Oleg Klimenko

Reputation: 137

Decoding QR code in python

I am trying to read QR codes using python3. I've found different solutions that depend on using qrtools.

I've also tried to download it using pip3 or apt-get. Then I've tried to install it from sources, tried to install zbar lib which it use to work, but I had multiple errors.

I've also tried to download and use it in python2, and it works successfully. And I want to ask, can I use it in python3, or it is impossible?

Upvotes: 2

Views: 20058

Answers (2)

taga
taga

Reputation: 3895

I have used pyzbar for reading my QR codes in Python3.

Installation:

brew install zbar
pip install pyqrcode
pip install pyzbar

And for reading the code:

from PIL import Image
from pyzbar.pyzbar import decode


result = decode(Image.open('sample.png'))
print(result)

Upvotes: 3

Martijn van Wezel
Martijn van Wezel

Reputation: 1180

I found the answer to the question: zbar QR code reader in python 3 in google. There is an library that does this. Download the follow library in pip install. ZBar it self is only for python 2, but the zbarlight also for python 3.

https://pypi.python.org/pypi/zbarlight

edit: My answer would be usefull: How to use Python Pip install software, to pull packages from Github?

Upvotes: 3

Related Questions